/* Generated by Cython 0.9.6.14 on Sat Jul 26 13:15:55 2008 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
#endif
#ifndef __stdcall
  #define __stdcall
#endif
#ifndef __cdecl
  #define __cdecl
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>


#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE 
#endif

typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/



static int __pyx_skip_dispatch = 0;


/* Type Conversion Predeclarations */

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);

#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))

static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
static INLINE char __pyx_PyInt_char(PyObject* x);
static INLINE short __pyx_PyInt_short(PyObject* x);
static INLINE int __pyx_PyInt_int(PyObject* x);
static INLINE long __pyx_PyInt_long(PyObject* x);
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
static INLINE long double __pyx_PyInt_long_double(PyObject* x);
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static char * __pyx_cfilenm= __FILE__;
static char *__pyx_filename;
static char **__pyx_f;

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/

static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (PyList_Append(L, x) < 0) return NULL;
        Py_INCREF(Py_None);
        return Py_None; // this is just to have an accurate signature
    }
    else {
        return PyObject_CallMethod(L, "append", "(O)", x);
    }
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations */

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":141
 * 
 * 
 * cdef class NFACursor:             # <<<<<<<<<<<<<< 
 *     cdef object nfa
 *     cdef object state
 */

struct __pyx_obj_5tests_7cyTrail_NFACursor {
  PyObject_HEAD
  struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *__pyx_vtab;
  PyObject *nfa;
  PyObject *state;
  struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *mtrace;
  PyObject *terminated;
  PyObject *transitions;
  PyObject *cache;
};

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":211
 * 
 * 
 * cdef class SimpleNFACursor(NFACursor):             # <<<<<<<<<<<<<< 
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]
 */

struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor {
  struct __pyx_obj_5tests_7cyTrail_NFACursor __pyx_base;
};

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":3
 * SKIP = '.'
 * 
 * cdef class NFATraceNode:             # <<<<<<<<<<<<<< 
 *     cdef NFATraceNode parent
 *     cdef object label
 */

struct __pyx_obj_5tests_7cyTrail_NFATraceNode {
  PyObject_HEAD
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *parent;
  PyObject *label;
  PyObject *token;
};

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":240
 *         return selection
 * 
 * cdef class LexerUnit:             # <<<<<<<<<<<<<< 
 *     cdef int tabwidth
 *     cdef int intron
 */

struct __pyx_obj_5tests_7cyTrail_LexerUnit {
  PyObject_HEAD
  struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *__pyx_vtab;
  int tabwidth;
  int intron;
  PyObject *sym_name;
  PyObject *tok_name;
};

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":20
 *         return True
 * 
 * cdef class NFAMultiTrace:             # <<<<<<<<<<<<<< 
 *     cdef object start
 *     cdef object traces
 */

struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace {
  PyObject_HEAD
  struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *__pyx_vtab;
  PyObject *start;
  PyObject *traces;
  PyObject *new_traces;
};


/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":141
 * 
 * 
 * cdef class NFACursor:             # <<<<<<<<<<<<<< 
 *     cdef object nfa
 *     cdef object state
 */

struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor {
  PyObject *(*_move)(struct __pyx_obj_5tests_7cyTrail_NFACursor *, PyObject *, PyObject *);
  PyObject *(*get_next_state)(struct __pyx_obj_5tests_7cyTrail_NFACursor *, PyObject *);
};
static struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *__pyx_vtabptr_5tests_7cyTrail_NFACursor;


/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":211
 * 
 * 
 * cdef class SimpleNFACursor(NFACursor):             # <<<<<<<<<<<<<< 
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]
 */

struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor {
  struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor __pyx_base;
};
static struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor *__pyx_vtabptr_5tests_7cyTrail_SimpleNFACursor;


/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":20
 *         return True
 * 
 * cdef class NFAMultiTrace:             # <<<<<<<<<<<<<< 
 *     cdef object start
 *     cdef object traces
 */

struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace {
  PyObject *(*set_token)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *, PyObject *);
  PyObject *(*terminate)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *);
  PyObject *(*flatten)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *);
  PyObject *(*update)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *, PyObject *, PyObject *);
  PyObject *(*commit)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *);
  PyObject *(*derive_tree)(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *, PyObject *);
};
static struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *__pyx_vtabptr_5tests_7cyTrail_NFAMultiTrace;


/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":240
 *         return selection
 * 
 * cdef class LexerUnit:             # <<<<<<<<<<<<<< 
 *     cdef int tabwidth
 *     cdef int intron
 */

struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit {
  PyObject *(*_handle_unit)(struct __pyx_obj_5tests_7cyTrail_LexerUnit *, PyObject *, PyObject *, PyObject *, PyObject *);
  PyObject *(*_tostr_lst)(struct __pyx_obj_5tests_7cyTrail_LexerUnit *, PyObject *);
};
static struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *__pyx_vtabptr_5tests_7cyTrail_LexerUnit;

static PyTypeObject *__pyx_ptype_5tests_7cyTrail_NFATraceNode = 0;
static PyTypeObject *__pyx_ptype_5tests_7cyTrail_NFAMultiTrace = 0;
static PyTypeObject *__pyx_ptype_5tests_7cyTrail_NFACursor = 0;
static PyTypeObject *__pyx_ptype_5tests_7cyTrail_SimpleNFACursor = 0;
static PyTypeObject *__pyx_ptype_5tests_7cyTrail_LexerUnit = 0;


/* Implementation of tests.cyTrail */

static char __pyx_k_1[] = ".";

static PyObject *__pyx_n___init__;
static PyObject *__pyx_n_derive_tree;
static PyObject *__pyx_n_node_sequence;
static PyObject *__pyx_n_set_token;
static PyObject *__pyx_n_terminate;
static PyObject *__pyx_n_set_nonterminal;
static PyObject *__pyx_n_move;
static PyObject *__pyx_n__move;
static PyObject *__pyx_n_handle_unit;
static PyObject *__pyx_n__handle_unit;
static PyObject *__pyx_n__tostr_lst;
static PyObject *__pyx_n_SKIP;

static PyObject *__pyx_k_1p;

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":7
 *     cdef object label
 *     cdef object token
 *     def __init__(self, NFATraceNode parent, label, tok = None):             # <<<<<<<<<<<<<< 
 *         self.parent = parent
 *         self.label  = label
 */

static int __pyx_pf_5tests_7cyTrail_12NFATraceNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5tests_7cyTrail_12NFATraceNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *__pyx_v_parent = 0;
  PyObject *__pyx_v_label = 0;
  PyObject *__pyx_v_tok = 0;
  int __pyx_r;
  static char *__pyx_argnames[] = {"parent","label","tok",0};
  __pyx_v_tok = Py_None;
  if (likely(!__pyx_kwds) && likely(2 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 3)) {
    __pyx_v_parent = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_label = PyTuple_GET_ITEM(__pyx_args, 1);
    if (PyTuple_GET_SIZE(__pyx_args) > 2) {
      __pyx_v_tok = PyTuple_GET_ITEM(__pyx_args, 2);
    }
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_parent, &__pyx_v_label, &__pyx_v_tok))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.NFATraceNode.__init__");
  return -1;
  __pyx_L3:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_5tests_7cyTrail_NFATraceNode, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1;}

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":8
 *     cdef object token
 *     def __init__(self, NFATraceNode parent, label, tok = None):
 *         self.parent = parent             # <<<<<<<<<<<<<< 
 *         self.label  = label
 *         self.token  = tok
 */
  Py_INCREF(((PyObject *)__pyx_v_parent));
  Py_DECREF(((PyObject *)((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->parent));
  ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->parent = __pyx_v_parent;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":9
 *     def __init__(self, NFATraceNode parent, label, tok = None):
 *         self.parent = parent
 *         self.label  = label             # <<<<<<<<<<<<<< 
 *         self.token  = tok
 * 
 */
  Py_INCREF(__pyx_v_label);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->label);
  ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->label = __pyx_v_label;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":10
 *         self.parent = parent
 *         self.label  = label
 *         self.token  = tok             # <<<<<<<<<<<<<< 
 * 
 * def is_token(nid):
 */
  Py_INCREF(__pyx_v_tok);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->token);
  ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_v_self)->token = __pyx_v_tok;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("tests.cyTrail.NFATraceNode.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":12
 *         self.token  = tok
 * 
 * def is_token(nid):             # <<<<<<<<<<<<<< 
 *     cdef int i
 *     if type(nid) == int:
 */

static PyObject *__pyx_pf_5tests_7cyTrail_is_token(PyObject *__pyx_self, PyObject *__pyx_v_nid); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_is_token(PyObject *__pyx_self, PyObject *__pyx_v_nid) {
  int __pyx_v_i;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  int __pyx_4;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":14
 * def is_token(nid):
 *     cdef int i
 *     if type(nid) == int:             # <<<<<<<<<<<<<< 
 *         i = nid
 *         return i % 512 < 256
 */
  __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_INCREF(__pyx_v_nid);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_nid);
  __pyx_2 = PyObject_Call(((PyObject*)&PyType_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
  __pyx_1 = PyObject_RichCompare(__pyx_2, ((PyObject*)&PyInt_Type), Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_3 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_3) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":15
 *     cdef int i
 *     if type(nid) == int:
 *         i = nid             # <<<<<<<<<<<<<< 
 *         return i % 512 < 256
 *     else:
 */
    __pyx_4 = __pyx_PyInt_int(__pyx_v_nid); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_v_i = __pyx_4;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":16
 *     if type(nid) == int:
 *         i = nid
 *         return i % 512 < 256             # <<<<<<<<<<<<<< 
 *     else:
 *         return True
 */
    __pyx_2 = __Pyx_PyBool_FromLong(((__pyx_v_i % 512) < 256)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":18
 *         return i % 512 < 256
 *     else:
 *         return True             # <<<<<<<<<<<<<< 
 * 
 * cdef class NFAMultiTrace:
 */
    Py_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tests.cyTrail.is_token");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":24
 *     cdef object traces
 *     cdef object new_traces
 *     def __init__(self, start):             # <<<<<<<<<<<<<< 
 *         self.start  = start
 *         self.traces = {start: NFATraceNode(None, start)}
 */

static int __pyx_pf_5tests_7cyTrail_13NFAMultiTrace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5tests_7cyTrail_13NFAMultiTrace___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_start = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"start",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) {
    __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 0);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_start))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.__init__");
  return -1;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":25
 *     cdef object new_traces
 *     def __init__(self, start):
 *         self.start  = start             # <<<<<<<<<<<<<< 
 *         self.traces = {start: NFATraceNode(None, start)}
 *         self.new_traces = {}
 */
  Py_INCREF(__pyx_v_start);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->start);
  ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->start = __pyx_v_start;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":26
 *     def __init__(self, start):
 *         self.start  = start
 *         self.traces = {start: NFATraceNode(None, start)}             # <<<<<<<<<<<<<< 
 *         self.new_traces = {}
 * 
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_2, 0, Py_None);
  Py_INCREF(__pyx_v_start);
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_start);
  __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_5tests_7cyTrail_NFATraceNode), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  if (PyDict_SetItem(__pyx_1, __pyx_v_start, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->traces);
  ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->traces = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":27
 *         self.start  = start
 *         self.traces = {start: NFATraceNode(None, start)}
 *         self.new_traces = {}             # <<<<<<<<<<<<<< 
 * 
 *     cdef set_token(self, tok):
 */
  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->new_traces);
  ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self)->new_traces = ((PyObject *)__pyx_2);
  __pyx_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":29
 *         self.new_traces = {}
 * 
 *     cdef set_token(self, tok):             # <<<<<<<<<<<<<< 
 *         cdef NFATraceNode node
 *         for label in self.traces:
 */

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_set_token(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self, PyObject *__pyx_v_tok) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *__pyx_v_node;
  PyObject *__pyx_v_label;
  PyObject *__pyx_r;
  Py_ssize_t __pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  int __pyx_5;
  __pyx_v_node = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)Py_None); Py_INCREF(Py_None);
  __pyx_v_label = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":31
 *     cdef set_token(self, tok):
 *         cdef NFATraceNode node
 *         for label in self.traces:             # <<<<<<<<<<<<<< 
 *             if label[0] in tok[:2]:
 *                 node = self.traces[label]
 */
  if (PyList_CheckExact(__pyx_v_self->traces)) { __pyx_1 = 0; __pyx_2 = __pyx_v_self->traces; Py_INCREF(__pyx_2); }
  else { __pyx_2 = PyObject_GetIter(__pyx_v_self->traces); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_2)) { if (__pyx_1 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_1++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_2);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":32
 *         cdef NFATraceNode node
 *         for label in self.traces:
 *             if label[0] in tok[:2]:             # <<<<<<<<<<<<<< 
 *                 node = self.traces[label]
 *                 node.token = tok
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_4);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_4);
      } else {
      __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_4 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_3 = PySequence_GetSlice(__pyx_v_tok, 0, 2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = (PySequence_Contains(__pyx_3, __pyx_4)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":33
 *         for label in self.traces:
 *             if label[0] in tok[:2]:
 *                 node = self.traces[label]             # <<<<<<<<<<<<<< 
 *                 node.token = tok
 * 
 */
      __pyx_4 = PyObject_GetItem(__pyx_v_self->traces, __pyx_v_label); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1;}
      if (!(__Pyx_TypeTest(__pyx_4, __pyx_ptype_5tests_7cyTrail_NFATraceNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_4);
      __pyx_4 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":34
 *             if label[0] in tok[:2]:
 *                 node = self.traces[label]
 *                 node.token = tok             # <<<<<<<<<<<<<< 
 * 
 *     cdef terminate(self):
 */
      Py_INCREF(__pyx_v_tok);
      Py_DECREF(__pyx_v_node->token);
      __pyx_v_node->token = __pyx_v_tok;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.set_token");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_node);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":36
 *                 node.token = tok
 * 
 *     cdef terminate(self):             # <<<<<<<<<<<<<< 
 *         for parent in self.traces:
 *             self.update(parent, [[(None, '-', parent[-1])]])
 */

static PyObject *__pyx_k_2p;

static char __pyx_k_2[] = "-";

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_terminate(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self) {
  PyObject *__pyx_v_parent;
  PyObject *__pyx_r;
  Py_ssize_t __pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  __pyx_v_parent = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":37
 * 
 *     cdef terminate(self):
 *         for parent in self.traces:             # <<<<<<<<<<<<<< 
 *             self.update(parent, [[(None, '-', parent[-1])]])
 *         self.commit()
 */
  if (PyList_CheckExact(__pyx_v_self->traces)) { __pyx_1 = 0; __pyx_2 = __pyx_v_self->traces; Py_INCREF(__pyx_2); }
  else { __pyx_2 = PyObject_GetIter(__pyx_v_self->traces); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_2)) { if (__pyx_1 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_1++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_2);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_parent);
    __pyx_v_parent = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":38
 *     cdef terminate(self):
 *         for parent in self.traces:
 *             self.update(parent, [[(None, '-', parent[-1])]])             # <<<<<<<<<<<<<< 
 *         self.commit()
 * 
 */
    if (PyList_CheckExact(__pyx_v_parent) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_parent)) {
      __pyx_4 = PyList_GET_ITEM(__pyx_v_parent, -1); Py_INCREF(__pyx_4);
      } else if (PyTuple_CheckExact(__pyx_v_parent) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_parent)) {
      __pyx_4 = PyTuple_GET_ITEM(__pyx_v_parent, -1); Py_INCREF(__pyx_4);
      } else {
      __pyx_3 = PyInt_FromLong(-1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_4 = PyObject_GetItem(__pyx_v_parent, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_3 = PyTuple_New(3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_3, 0, Py_None);
    Py_INCREF(__pyx_k_2p);
    PyTuple_SET_ITEM(__pyx_3, 1, __pyx_k_2p);
    PyTuple_SET_ITEM(__pyx_3, 2, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyList_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_3));
    __pyx_3 = 0;
    __pyx_3 = PyList_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_4));
    __pyx_4 = 0;
    __pyx_4 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_parent, ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":39
 *         for parent in self.traces:
 *             self.update(parent, [[(None, '-', parent[-1])]])
 *         self.commit()             # <<<<<<<<<<<<<< 
 * 
 *     cdef flatten(self):
 */
  __pyx_3 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->__pyx_vtab)->commit(__pyx_v_self); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.terminate");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_parent);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":41
 *         self.commit()
 * 
 *     cdef flatten(self):             # <<<<<<<<<<<<<< 
 *         cdef NFATraceNode node
 *         lst = []
 */

static PyObject *__pyx_n_RuntimeError;
static PyObject *__pyx_n_append;

static PyObject *__pyx_k_3p;

static PyObject *__pyx_builtin_RuntimeError;

static char __pyx_k_3[] = "Incomplete Trace. No exit symbol found.";

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_flatten(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *__pyx_v_node;
  PyObject *__pyx_v_lst;
  PyObject *__pyx_v_label;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_ssize_t __pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  int __pyx_5;
  __pyx_v_node = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)Py_None); Py_INCREF(Py_None);
  __pyx_v_lst = Py_None; Py_INCREF(Py_None);
  __pyx_v_label = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":43
 *     cdef flatten(self):
 *         cdef NFATraceNode node
 *         lst = []             # <<<<<<<<<<<<<< 
 *         for label in self.traces:
 *             if label[0] is None:
 */
  __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_lst);
  __pyx_v_lst = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":44
 *         cdef NFATraceNode node
 *         lst = []
 *         for label in self.traces:             # <<<<<<<<<<<<<< 
 *             if label[0] is None:
 *                 node = self.traces[label]
 */
  if (PyList_CheckExact(__pyx_v_self->traces)) { __pyx_2 = 0; __pyx_1 = __pyx_v_self->traces; Py_INCREF(__pyx_1); }
  else { __pyx_1 = PyObject_GetIter(__pyx_v_self->traces); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_1);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":45
 *         lst = []
 *         for label in self.traces:
 *             if label[0] is None:             # <<<<<<<<<<<<<< 
 *                 node = self.traces[label]
 *                 break
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_4);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_4);
      } else {
      __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_4 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_5 = (__pyx_4 == Py_None);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":46
 *         for label in self.traces:
 *             if label[0] is None:
 *                 node = self.traces[label]             # <<<<<<<<<<<<<< 
 *                 break
 *         else:
 */
      __pyx_3 = PyObject_GetItem(__pyx_v_self->traces, __pyx_v_label); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1;}
      if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5tests_7cyTrail_NFATraceNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)__pyx_3);
      __pyx_3 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":47
 *             if label[0] is None:
 *                 node = self.traces[label]
 *                 break             # <<<<<<<<<<<<<< 
 *         else:
 *             raise RuntimeError("Incomplete Trace. No exit symbol found.")
 */
      goto __pyx_L3;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":49
 *                 break
 *         else:
 *             raise RuntimeError("Incomplete Trace. No exit symbol found.")             # <<<<<<<<<<<<<< 
 *         while node:
 *             label = node.label
 */
    __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_k_3p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k_3p);
    __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1;}
  }
  __pyx_L3:;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":50
 *         else:
 *             raise RuntimeError("Incomplete Trace. No exit symbol found.")
 *         while node:             # <<<<<<<<<<<<<< 
 *             label = node.label
 *             if label[0] is None:
 */
  while (1) {
    __pyx_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_node)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!__pyx_5) break;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":51
 *             raise RuntimeError("Incomplete Trace. No exit symbol found.")
 *         while node:
 *             label = node.label             # <<<<<<<<<<<<<< 
 *             if label[0] is None:
 *                 lst.append(label)
 */
    Py_INCREF(__pyx_v_node->label);
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_v_node->label;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":52
 *         while node:
 *             label = node.label
 *             if label[0] is None:             # <<<<<<<<<<<<<< 
 *                 lst.append(label)
 *                 node = node.parent
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_3 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_3);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_3 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_3);
      } else {
      __pyx_4 = PyInt_FromLong(0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_GetItem(__pyx_v_label, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
    }
    __pyx_5 = (__pyx_3 == Py_None);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":53
 *             label = node.label
 *             if label[0] is None:
 *                 lst.append(label)             # <<<<<<<<<<<<<< 
 *                 node = node.parent
 *                 continue
 */
      __pyx_1 = __Pyx_PyObject_Append(__pyx_v_lst, __pyx_v_label); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":54
 *             if label[0] is None:
 *                 lst.append(label)
 *                 node = node.parent             # <<<<<<<<<<<<<< 
 *                 continue
 *             if node.token:
 */
      Py_INCREF(((PyObject *)__pyx_v_node->parent));
      Py_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = __pyx_v_node->parent;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":55
 *                 lst.append(label)
 *                 node = node.parent
 *                 continue             # <<<<<<<<<<<<<< 
 *             if node.token:
 *                 lst.append((label[0], node.token, label[-1]))
 */
      goto __pyx_L5;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":56
 *                 node = node.parent
 *                 continue
 *             if node.token:             # <<<<<<<<<<<<<< 
 *                 lst.append((label[0], node.token, label[-1]))
 *             else:
 */
    __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_v_node->token); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":57
 *                 continue
 *             if node.token:
 *                 lst.append((label[0], node.token, label[-1]))             # <<<<<<<<<<<<<< 
 *             else:
 *                 lst.append( label )
 */
      if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_3);
        } else {
        __pyx_4 = PyInt_FromLong(0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_label, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
      }
      if (PyList_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_4 = PyList_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_4);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_4 = PyTuple_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_4);
        } else {
        __pyx_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_4 = PyObject_GetItem(__pyx_v_label, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
      }
      __pyx_1 = PyTuple_New(3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
      Py_INCREF(__pyx_v_node->token);
      PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_node->token);
      PyTuple_SET_ITEM(__pyx_1, 2, __pyx_4);
      __pyx_3 = 0;
      __pyx_4 = 0;
      __pyx_3 = __Pyx_PyObject_Append(__pyx_v_lst, ((PyObject *)__pyx_1)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":59
 *                 lst.append((label[0], node.token, label[-1]))
 *             else:
 *                 lst.append( label )             # <<<<<<<<<<<<<< 
 *             node = node.parent
 *         return lst
 */
      __pyx_4 = __Pyx_PyObject_Append(__pyx_v_lst, __pyx_v_label); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
    }
    __pyx_L8:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":60
 *             else:
 *                 lst.append( label )
 *             node = node.parent             # <<<<<<<<<<<<<< 
 *         return lst
 * 
 */
    Py_INCREF(((PyObject *)__pyx_v_node->parent));
    Py_DECREF(((PyObject *)__pyx_v_node));
    __pyx_v_node = __pyx_v_node->parent;
    __pyx_L5:;
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":61
 *                 lst.append( label )
 *             node = node.parent
 *         return lst             # <<<<<<<<<<<<<< 
 * 
 * 
 */
  Py_INCREF(__pyx_v_lst);
  __pyx_r = __pyx_v_lst;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.flatten");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_node);
  Py_DECREF(__pyx_v_lst);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":64
 * 
 * 
 *     cdef update(self, parent, follow):             # <<<<<<<<<<<<<< 
 *         cdef int i,j,n,m
 *         trRoot = self.traces.get(parent)
 */

static PyObject *__pyx_n_get;

static PyObject *__pyx_k_4p;

static char __pyx_k_4[] = "Can't connect label %s with NFAMultiTrace datastructure";

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_update(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self, PyObject *__pyx_v_parent, PyObject *__pyx_v_follow) {
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_n;
  int __pyx_v_m;
  PyObject *__pyx_v_trRoot;
  PyObject *__pyx_v_new_traces;
  PyObject *__pyx_v_S;
  PyObject *__pyx_v_trNode;
  PyObject *__pyx_v_label;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  Py_ssize_t __pyx_5 = 0;
  __pyx_v_trRoot = Py_None; Py_INCREF(Py_None);
  __pyx_v_new_traces = Py_None; Py_INCREF(Py_None);
  __pyx_v_S = Py_None; Py_INCREF(Py_None);
  __pyx_v_trNode = Py_None; Py_INCREF(Py_None);
  __pyx_v_label = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":66
 *     cdef update(self, parent, follow):
 *         cdef int i,j,n,m
 *         trRoot = self.traces.get(parent)             # <<<<<<<<<<<<<< 
 *         new_traces = {}
 *         if trRoot is None:
 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self->traces, __pyx_n_get); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_INCREF(__pyx_v_parent);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_parent);
  __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  Py_DECREF(__pyx_v_trRoot);
  __pyx_v_trRoot = __pyx_3;
  __pyx_3 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":67
 *         cdef int i,j,n,m
 *         trRoot = self.traces.get(parent)
 *         new_traces = {}             # <<<<<<<<<<<<<< 
 *         if trRoot is None:
 *             raise RuntimeError("Can't connect label %s with NFAMultiTrace datastructure"%(parent,))
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_new_traces);
  __pyx_v_new_traces = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":68
 *         trRoot = self.traces.get(parent)
 *         new_traces = {}
 *         if trRoot is None:             # <<<<<<<<<<<<<< 
 *             raise RuntimeError("Can't connect label %s with NFAMultiTrace datastructure"%(parent,))
 *         n = len(follow)
 */
  __pyx_4 = (__pyx_v_trRoot == Py_None);
  if (__pyx_4) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":69
 *         new_traces = {}
 *         if trRoot is None:
 *             raise RuntimeError("Can't connect label %s with NFAMultiTrace datastructure"%(parent,))             # <<<<<<<<<<<<<< 
 *         n = len(follow)
 *         for i from 0<=i<n:
 */
    __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_parent);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_parent);
    __pyx_3 = PyNumber_Remainder(__pyx_k_4p, ((PyObject *)__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
    __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":70
 *         if trRoot is None:
 *             raise RuntimeError("Can't connect label %s with NFAMultiTrace datastructure"%(parent,))
 *         n = len(follow)             # <<<<<<<<<<<<<< 
 *         for i from 0<=i<n:
 *             S = follow[i]
 */
  __pyx_5 = PyObject_Length(__pyx_v_follow); if (unlikely(__pyx_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_v_n = __pyx_5;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":71
 *             raise RuntimeError("Can't connect label %s with NFAMultiTrace datastructure"%(parent,))
 *         n = len(follow)
 *         for i from 0<=i<n:             # <<<<<<<<<<<<<< 
 *             S = follow[i]
 *             m = len(S)
 */
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_n; __pyx_v_i++) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":72
 *         n = len(follow)
 *         for i from 0<=i<n:
 *             S = follow[i]             # <<<<<<<<<<<<<< 
 *             m = len(S)
 *             trNode = trRoot
 */
    if (PyList_CheckExact(__pyx_v_follow) && 0 <= __pyx_v_i && __pyx_v_i < PyList_GET_SIZE(__pyx_v_follow)) {
      __pyx_1 = PyList_GET_ITEM(__pyx_v_follow, __pyx_v_i); Py_INCREF(__pyx_1);
      } else if (PyTuple_CheckExact(__pyx_v_follow) && 0 <= __pyx_v_i && __pyx_v_i < PyTuple_GET_SIZE(__pyx_v_follow)) {
      __pyx_1 = PyTuple_GET_ITEM(__pyx_v_follow, __pyx_v_i); Py_INCREF(__pyx_1);
      } else {
      __pyx_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyObject_GetItem(__pyx_v_follow, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    Py_DECREF(__pyx_v_S);
    __pyx_v_S = __pyx_1;
    __pyx_1 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":73
 *         for i from 0<=i<n:
 *             S = follow[i]
 *             m = len(S)             # <<<<<<<<<<<<<< 
 *             trNode = trRoot
 *             for j from 0<=j<m:
 */
    __pyx_5 = PyObject_Length(__pyx_v_S); if (unlikely(__pyx_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_v_m = __pyx_5;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":74
 *             S = follow[i]
 *             m = len(S)
 *             trNode = trRoot             # <<<<<<<<<<<<<< 
 *             for j from 0<=j<m:
 *                 label = S[j]
 */
    Py_INCREF(__pyx_v_trRoot);
    Py_DECREF(__pyx_v_trNode);
    __pyx_v_trNode = __pyx_v_trRoot;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":75
 *             m = len(S)
 *             trNode = trRoot
 *             for j from 0<=j<m:             # <<<<<<<<<<<<<< 
 *                 label = S[j]
 *                 trNode = NFATraceNode(trNode, label)
 */
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_m; __pyx_v_j++) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":76
 *             trNode = trRoot
 *             for j from 0<=j<m:
 *                 label = S[j]             # <<<<<<<<<<<<<< 
 *                 trNode = NFATraceNode(trNode, label)
 *             self.new_traces[label] = trNode
 */
      if (PyList_CheckExact(__pyx_v_S) && 0 <= __pyx_v_j && __pyx_v_j < PyList_GET_SIZE(__pyx_v_S)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_S, __pyx_v_j); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_S) && 0 <= __pyx_v_j && __pyx_v_j < PyTuple_GET_SIZE(__pyx_v_S)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_S, __pyx_v_j); Py_INCREF(__pyx_3);
        } else {
        __pyx_2 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_S, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
      }
      Py_DECREF(__pyx_v_label);
      __pyx_v_label = __pyx_3;
      __pyx_3 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":77
 *             for j from 0<=j<m:
 *                 label = S[j]
 *                 trNode = NFATraceNode(trNode, label)             # <<<<<<<<<<<<<< 
 *             self.new_traces[label] = trNode
 * 
 */
      __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_trNode);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_trNode);
      Py_INCREF(__pyx_v_label);
      PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_label);
      __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_5tests_7cyTrail_NFATraceNode), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      Py_DECREF(__pyx_v_trNode);
      __pyx_v_trNode = __pyx_2;
      __pyx_2 = 0;
    }

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":78
 *                 label = S[j]
 *                 trNode = NFATraceNode(trNode, label)
 *             self.new_traces[label] = trNode             # <<<<<<<<<<<<<< 
 * 
 *     cdef commit(self):
 */
    if (PyObject_SetItem(__pyx_v_self->new_traces, __pyx_v_label, __pyx_v_trNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1;}
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.update");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_trRoot);
  Py_DECREF(__pyx_v_new_traces);
  Py_DECREF(__pyx_v_S);
  Py_DECREF(__pyx_v_trNode);
  Py_DECREF(__pyx_v_label);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":80
 *             self.new_traces[label] = trNode
 * 
 *     cdef commit(self):             # <<<<<<<<<<<<<< 
 *         self.traces = self.new_traces
 *         self.new_traces = {}
 */

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_commit(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":81
 * 
 *     cdef commit(self):
 *         self.traces = self.new_traces             # <<<<<<<<<<<<<< 
 *         self.new_traces = {}
 * 
 */
  Py_INCREF(__pyx_v_self->new_traces);
  Py_DECREF(__pyx_v_self->traces);
  __pyx_v_self->traces = __pyx_v_self->new_traces;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":82
 *     cdef commit(self):
 *         self.traces = self.new_traces
 *         self.new_traces = {}             # <<<<<<<<<<<<<< 
 * 
 *     cdef derive_tree(self, sub_trees):
 */
  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_self->new_traces);
  __pyx_v_self->new_traces = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.commit");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":84
 *         self.new_traces = {}
 * 
 *     cdef derive_tree(self, sub_trees):             # <<<<<<<<<<<<<< 
 *         '''
 *         Creates parse tree from label list. sub_trees replace corresponding node ids if available.
 */

static PyObject *__pyx_int_2;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_0;

static PyObject *__pyx_n_pop;
static PyObject *__pyx_n_ValueError;

static PyObject *__pyx_k_5p;
static PyObject *__pyx_k_6p;

static PyObject *__pyx_builtin_ValueError;

static char __pyx_k_5[] = "Exit label `(None, ..)` missing in: %s";
static char __pyx_k_6[] = "No trace available";

static  PyObject *__pyx_f_5tests_7cyTrail_13NFAMultiTrace_derive_tree(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *__pyx_v_self, PyObject *__pyx_v_sub_trees) {
  PyObject *__pyx_v_labels;
  int __pyx_v_i;
  PyObject *__pyx_v_root;
  PyObject *__pyx_v_stack;
  PyObject *__pyx_v_reminder;
  PyObject *__pyx_v_n;
  PyObject *__pyx_v_label;
  PyObject *__pyx_v_S;
  PyObject *__pyx_v_entry;
  PyObject *__pyx_v_sub;
  PyObject *__pyx_v_link;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_ssize_t __pyx_4 = 0;
  int __pyx_5;
  int __pyx_6;
  int __pyx_7;
  PyObject *__pyx_8 = 0;
  __pyx_v_labels = Py_None; Py_INCREF(Py_None);
  __pyx_v_root = Py_None; Py_INCREF(Py_None);
  __pyx_v_stack = Py_None; Py_INCREF(Py_None);
  __pyx_v_reminder = Py_None; Py_INCREF(Py_None);
  __pyx_v_n = Py_None; Py_INCREF(Py_None);
  __pyx_v_label = Py_None; Py_INCREF(Py_None);
  __pyx_v_S = Py_None; Py_INCREF(Py_None);
  __pyx_v_entry = Py_None; Py_INCREF(Py_None);
  __pyx_v_sub = Py_None; Py_INCREF(Py_None);
  __pyx_v_link = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":88
 *         Creates parse tree from label list. sub_trees replace corresponding node ids if available.
 *         '''
 *         labels = self.flatten()             # <<<<<<<<<<<<<< 
 *         cdef int i,k
 *         root = labels[-1][0]
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->__pyx_vtab)->flatten(__pyx_v_self); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_labels);
  __pyx_v_labels = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":90
 *         labels = self.flatten()
 *         cdef int i,k
 *         root = labels[-1][0]             # <<<<<<<<<<<<<< 
 *         stack = []
 *         reminder = [root]
 */
  if (PyList_CheckExact(__pyx_v_labels) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_labels)) {
    __pyx_2 = PyList_GET_ITEM(__pyx_v_labels, -1); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(__pyx_v_labels) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_labels)) {
    __pyx_2 = PyTuple_GET_ITEM(__pyx_v_labels, -1); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(__pyx_v_labels, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) {
    __pyx_3 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_3);
    } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) {
    __pyx_3 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_3);
    } else {
    __pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_3 = PyObject_GetItem(__pyx_2, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_root);
  __pyx_v_root = __pyx_3;
  __pyx_3 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":91
 *         cdef int i,k
 *         root = labels[-1][0]
 *         stack = []             # <<<<<<<<<<<<<< 
 *         reminder = [root]
 *         n = len(labels)
 */
  __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_stack);
  __pyx_v_stack = ((PyObject *)__pyx_2);
  __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":92
 *         root = labels[-1][0]
 *         stack = []
 *         reminder = [root]             # <<<<<<<<<<<<<< 
 *         n = len(labels)
 *         for i from n-2>=i>-1:
 */
  __pyx_1 = PyList_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_INCREF(__pyx_v_root);
  PyList_SET_ITEM(__pyx_1, 0, __pyx_v_root);
  Py_DECREF(__pyx_v_reminder);
  __pyx_v_reminder = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":93
 *         stack = []
 *         reminder = [root]
 *         n = len(labels)             # <<<<<<<<<<<<<< 
 *         for i from n-2>=i>-1:
 *             label = labels[i]
 */
  __pyx_4 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_3 = PyInt_FromSsize_t(__pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_n);
  __pyx_v_n = __pyx_3;
  __pyx_3 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":94
 *         reminder = [root]
 *         n = len(labels)
 *         for i from n-2>=i>-1:             # <<<<<<<<<<<<<< 
 *             label = labels[i]
 *             if label[1] == SKIP:
 */
  __pyx_2 = PyNumber_Subtract(__pyx_v_n, __pyx_int_2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_5 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  for (__pyx_v_i = __pyx_5; __pyx_v_i > -1; __pyx_v_i--) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":95
 *         n = len(labels)
 *         for i from n-2>=i>-1:
 *             label = labels[i]             # <<<<<<<<<<<<<< 
 *             if label[1] == SKIP:
 *                 S = []
 */
    if (PyList_CheckExact(__pyx_v_labels) && 0 <= __pyx_v_i && __pyx_v_i < PyList_GET_SIZE(__pyx_v_labels)) {
      __pyx_3 = PyList_GET_ITEM(__pyx_v_labels, __pyx_v_i); Py_INCREF(__pyx_3);
      } else if (PyTuple_CheckExact(__pyx_v_labels) && 0 <= __pyx_v_i && __pyx_v_i < PyTuple_GET_SIZE(__pyx_v_labels)) {
      __pyx_3 = PyTuple_GET_ITEM(__pyx_v_labels, __pyx_v_i); Py_INCREF(__pyx_3);
      } else {
      __pyx_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_GetItem(__pyx_v_labels, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
    }
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":96
 *         for i from n-2>=i>-1:
 *             label = labels[i]
 *             if label[1] == SKIP:             # <<<<<<<<<<<<<< 
 *                 S = []
 *                 reminder.pop()
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_1 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
      } else {
      __pyx_2 = PyInt_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
    }
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_SKIP); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_3, Py_EQ); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_6 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__pyx_6) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":97
 *             label = labels[i]
 *             if label[1] == SKIP:
 *                 S = []             # <<<<<<<<<<<<<< 
 *                 reminder.pop()
 *                 entry = stack.pop()
 */
      __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_v_S);
      __pyx_v_S = ((PyObject *)__pyx_1);
      __pyx_1 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":98
 *             if label[1] == SKIP:
 *                 S = []
 *                 reminder.pop()             # <<<<<<<<<<<<<< 
 *                 entry = stack.pop()
 *                 while entry!=label[0]:
 */
      __pyx_3 = PyObject_GetAttr(__pyx_v_reminder, __pyx_n_pop); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":99
 *                 S = []
 *                 reminder.pop()
 *                 entry = stack.pop()             # <<<<<<<<<<<<<< 
 *                 while entry!=label[0]:
 *                     S.append(entry)
 */
      __pyx_1 = PyObject_GetAttr(__pyx_v_stack, __pyx_n_pop); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_v_entry);
      __pyx_v_entry = __pyx_3;
      __pyx_3 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":100
 *                 reminder.pop()
 *                 entry = stack.pop()
 *                 while entry!=label[0]:             # <<<<<<<<<<<<<< 
 *                     S.append(entry)
 *                     entry = stack.pop()
 */
      while (1) {
        if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_1);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_1);
          } else {
          __pyx_2 = PyInt_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_2); __pyx_2 = 0;
        }
        __pyx_3 = PyObject_RichCompare(__pyx_v_entry, __pyx_1, Py_NE); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_6 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        if (!__pyx_6) break;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":101
 *                 entry = stack.pop()
 *                 while entry!=label[0]:
 *                     S.append(entry)             # <<<<<<<<<<<<<< 
 *                     entry = stack.pop()
 *                 S.append(entry)
 */
        __pyx_2 = __Pyx_PyObject_Append(__pyx_v_S, __pyx_v_entry); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":102
 *                 while entry!=label[0]:
 *                     S.append(entry)
 *                     entry = stack.pop()             # <<<<<<<<<<<<<< 
 *                 S.append(entry)
 *                 if label[-1]!=reminder[-1]:
 */
        __pyx_1 = PyObject_GetAttr(__pyx_v_stack, __pyx_n_pop); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_v_entry);
        __pyx_v_entry = __pyx_3;
        __pyx_3 = 0;
      }

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":103
 *                     S.append(entry)
 *                     entry = stack.pop()
 *                 S.append(entry)             # <<<<<<<<<<<<<< 
 *                 if label[-1]!=reminder[-1]:
 *                     stack.append(label[-1])
 */
      __pyx_2 = __Pyx_PyObject_Append(__pyx_v_S, __pyx_v_entry); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":104
 *                     entry = stack.pop()
 *                 S.append(entry)
 *                 if label[-1]!=reminder[-1]:             # <<<<<<<<<<<<<< 
 *                     stack.append(label[-1])
 *                     reminder.append(label[-1])
 */
      if (PyList_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_3);
        } else {
        __pyx_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_label, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
      }
      if (PyList_CheckExact(__pyx_v_reminder) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_reminder)) {
        __pyx_1 = PyList_GET_ITEM(__pyx_v_reminder, -1); Py_INCREF(__pyx_1);
        } else if (PyTuple_CheckExact(__pyx_v_reminder) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_reminder)) {
        __pyx_1 = PyTuple_GET_ITEM(__pyx_v_reminder, -1); Py_INCREF(__pyx_1);
        } else {
        __pyx_2 = PyInt_FromLong(-1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_1 = PyObject_GetItem(__pyx_v_reminder, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
      }
      __pyx_2 = PyObject_RichCompare(__pyx_3, __pyx_1, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_6 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      if (__pyx_6) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":105
 *                 S.append(entry)
 *                 if label[-1]!=reminder[-1]:
 *                     stack.append(label[-1])             # <<<<<<<<<<<<<< 
 *                     reminder.append(label[-1])
 *                 stack.append(S[::-1])
 */
        if (PyList_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyList_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_1);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_1);
          } else {
          __pyx_3 = PyInt_FromLong(-1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_3); __pyx_3 = 0;
        }
        __pyx_2 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":106
 *                 if label[-1]!=reminder[-1]:
 *                     stack.append(label[-1])
 *                     reminder.append(label[-1])             # <<<<<<<<<<<<<< 
 *                 stack.append(S[::-1])
 *                 continue
 */
        if (PyList_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyList_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_1);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_1);
          } else {
          __pyx_3 = PyInt_FromLong(-1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_3); __pyx_3 = 0;
        }
        __pyx_2 = __Pyx_PyObject_Append(__pyx_v_reminder, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":107
 *                     stack.append(label[-1])
 *                     reminder.append(label[-1])
 *                 stack.append(S[::-1])             # <<<<<<<<<<<<<< 
 *                 continue
 *             elif label[0] is None:
 */
      __pyx_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyObject_GetItem(__pyx_v_S, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_2 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":108
 *                     reminder.append(label[-1])
 *                 stack.append(S[::-1])
 *                 continue             # <<<<<<<<<<<<<< 
 *             elif label[0] is None:
 *                 if isinstance(stack[0], int):
 */
      goto __pyx_L2;
      goto __pyx_L4;
    }

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":109
 *                 stack.append(S[::-1])
 *                 continue
 *             elif label[0] is None:             # <<<<<<<<<<<<<< 
 *                 if isinstance(stack[0], int):
 *                     return stack
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_1 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_1);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_1);
      } else {
      __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_6 = (__pyx_1 == Py_None);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_6) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":110
 *                 continue
 *             elif label[0] is None:
 *                 if isinstance(stack[0], int):             # <<<<<<<<<<<<<< 
 *                     return stack
 *                 else:
 */
      if (PyList_CheckExact(__pyx_v_stack) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_stack)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_stack, 0); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_stack) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_stack)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_stack, 0); Py_INCREF(__pyx_3);
        } else {
        __pyx_2 = PyInt_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_stack, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
      }
      __pyx_6 = PyObject_IsInstance(__pyx_3, ((PyObject*)&PyInt_Type)); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      if (__pyx_6) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":111
 *             elif label[0] is None:
 *                 if isinstance(stack[0], int):
 *                     return stack             # <<<<<<<<<<<<<< 
 *                 else:
 *                     return [label[-1]]+stack
 */
        Py_INCREF(__pyx_v_stack);
        __pyx_r = __pyx_v_stack;
        goto __pyx_L0;
        goto __pyx_L8;
      }
      /*else*/ {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":113
 *                     return stack
 *                 else:
 *                     return [label[-1]]+stack             # <<<<<<<<<<<<<< 
 *             sub = (sub_trees[0] if sub_trees else None)
 *             label = list(label)
 */
        if (PyList_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_2 = PyList_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_2);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_2 = PyTuple_GET_ITEM(__pyx_v_label, -1); Py_INCREF(__pyx_2);
          } else {
          __pyx_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_2 = PyObject_GetItem(__pyx_v_label, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_1); __pyx_1 = 0;
        }
        __pyx_3 = PyList_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyList_SET_ITEM(__pyx_3, 0, __pyx_2);
        __pyx_2 = 0;
        __pyx_1 = PyNumber_Add(((PyObject *)__pyx_3), __pyx_v_stack); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
        __pyx_r = __pyx_1;
        __pyx_1 = 0;
        goto __pyx_L0;
      }
      __pyx_L8:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":114
 *                 else:
 *                     return [label[-1]]+stack
 *             sub = (sub_trees[0] if sub_trees else None)             # <<<<<<<<<<<<<< 
 *             label = list(label)
 *             link = label.pop()
 */
    __pyx_6 = __Pyx_PyObject_IsTrue(__pyx_v_sub_trees); if (unlikely(__pyx_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_6) {
      if (PyList_CheckExact(__pyx_v_sub_trees) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_sub_trees)) {
        __pyx_2 = PyList_GET_ITEM(__pyx_v_sub_trees, 0); Py_INCREF(__pyx_2);
        } else if (PyTuple_CheckExact(__pyx_v_sub_trees) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_sub_trees)) {
        __pyx_2 = PyTuple_GET_ITEM(__pyx_v_sub_trees, 0); Py_INCREF(__pyx_2);
        } else {
        __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_2 = PyObject_GetItem(__pyx_v_sub_trees, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
      }
      } else {
      __pyx_2 = Py_None;
      Py_INCREF(__pyx_2);
    }
    Py_DECREF(__pyx_v_sub);
    __pyx_v_sub = __pyx_2;
    __pyx_2 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":115
 *                     return [label[-1]]+stack
 *             sub = (sub_trees[0] if sub_trees else None)
 *             label = list(label)             # <<<<<<<<<<<<<< 
 *             link = label.pop()
 *             if link!=reminder[-1]:
 */
    __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_label);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_label);
    __pyx_3 = PyObject_Call(((PyObject*)&PyList_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":116
 *             sub = (sub_trees[0] if sub_trees else None)
 *             label = list(label)
 *             link = label.pop()             # <<<<<<<<<<<<<< 
 *             if link!=reminder[-1]:
 *                 stack.append(link)
 */
    __pyx_2 = PyObject_GetAttr(__pyx_v_label, __pyx_n_pop); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_1 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_v_link);
    __pyx_v_link = __pyx_1;
    __pyx_1 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":117
 *             label = list(label)
 *             link = label.pop()
 *             if link!=reminder[-1]:             # <<<<<<<<<<<<<< 
 *                 stack.append(link)
 *                 reminder.append(link)
 */
    if (PyList_CheckExact(__pyx_v_reminder) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_reminder)) {
      __pyx_2 = PyList_GET_ITEM(__pyx_v_reminder, -1); Py_INCREF(__pyx_2);
      } else if (PyTuple_CheckExact(__pyx_v_reminder) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_reminder)) {
      __pyx_2 = PyTuple_GET_ITEM(__pyx_v_reminder, -1); Py_INCREF(__pyx_2);
      } else {
      __pyx_3 = PyInt_FromLong(-1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_2 = PyObject_GetItem(__pyx_v_reminder, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_1 = PyObject_RichCompare(__pyx_v_link, __pyx_2, Py_NE); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_7) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":118
 *             link = label.pop()
 *             if link!=reminder[-1]:
 *                 stack.append(link)             # <<<<<<<<<<<<<< 
 *                 reminder.append(link)
 *             if sub:
 */
      __pyx_3 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_v_link); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":119
 *             if link!=reminder[-1]:
 *                 stack.append(link)
 *                 reminder.append(link)             # <<<<<<<<<<<<<< 
 *             if sub:
 *                 if sub[0] == label[0] and isinstance(label[1], int):
 */
      __pyx_2 = __Pyx_PyObject_Append(__pyx_v_reminder, __pyx_v_link); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":120
 *                 stack.append(link)
 *                 reminder.append(link)
 *             if sub:             # <<<<<<<<<<<<<< 
 *                 if sub[0] == label[0] and isinstance(label[1], int):
 *                     sub_trees.pop(0)
 */
    __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_v_sub); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_7) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":121
 *                 reminder.append(link)
 *             if sub:
 *                 if sub[0] == label[0] and isinstance(label[1], int):             # <<<<<<<<<<<<<< 
 *                     sub_trees.pop(0)
 *                     stack.append(sub)
 */
      if (PyList_CheckExact(__pyx_v_sub) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_sub)) {
        __pyx_2 = PyList_GET_ITEM(__pyx_v_sub, 0); Py_INCREF(__pyx_2);
        } else if (PyTuple_CheckExact(__pyx_v_sub) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_sub)) {
        __pyx_2 = PyTuple_GET_ITEM(__pyx_v_sub, 0); Py_INCREF(__pyx_2);
        } else {
        __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_2 = PyObject_GetItem(__pyx_v_sub, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
      }
      if (PyList_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_8 = PyList_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_8);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_8 = PyTuple_GET_ITEM(__pyx_v_label, 0); Py_INCREF(__pyx_8);
        } else {
        __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_8 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
      }
      __pyx_1 = PyObject_RichCompare(__pyx_2, __pyx_8, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_8); __pyx_8 = 0;
      __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
      if (__pyx_7) {
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_2 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_2);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_2 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_2);
          } else {
          __pyx_3 = PyInt_FromLong(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_2 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_3); __pyx_3 = 0;
        }
        __pyx_7 = PyObject_IsInstance(__pyx_2, ((PyObject*)&PyInt_Type)); if (unlikely(__pyx_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        __pyx_1 = __Pyx_PyBool_FromLong(__pyx_7); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
      }
      __pyx_7 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      if (__pyx_7) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":122
 *             if sub:
 *                 if sub[0] == label[0] and isinstance(label[1], int):
 *                     sub_trees.pop(0)             # <<<<<<<<<<<<<< 
 *                     stack.append(sub)
 *                 elif isinstance(label[1], list):
 */
        __pyx_8 = PyObject_GetAttr(__pyx_v_sub_trees, __pyx_n_pop); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_int_0);
        __pyx_2 = PyObject_Call(__pyx_8, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_8); __pyx_8 = 0;
        Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":123
 *                 if sub[0] == label[0] and isinstance(label[1], int):
 *                     sub_trees.pop(0)
 *                     stack.append(sub)             # <<<<<<<<<<<<<< 
 *                 elif isinstance(label[1], list):
 *                     stack.append(label[1])
 */
        __pyx_1 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_v_sub); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        goto __pyx_L11;
      }

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":124
 *                     sub_trees.pop(0)
 *                     stack.append(sub)
 *                 elif isinstance(label[1], list):             # <<<<<<<<<<<<<< 
 *                     stack.append(label[1])
 *                 else:
 */
      if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_3);
        } else {
        __pyx_8 = PyInt_FromLong(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_label, __pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_8); __pyx_8 = 0;
      }
      __pyx_7 = PyObject_IsInstance(__pyx_3, ((PyObject*)&PyList_Type)); if (unlikely(__pyx_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      if (__pyx_7) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":125
 *                     stack.append(sub)
 *                 elif isinstance(label[1], list):
 *                     stack.append(label[1])             # <<<<<<<<<<<<<< 
 *                 else:
 *                     stack.append(label)
 */
        if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
          } else {
          __pyx_2 = PyInt_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_2); __pyx_2 = 0;
        }
        __pyx_8 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_8); __pyx_8 = 0;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":127
 *                     stack.append(label[1])
 *                 else:
 *                     stack.append(label)             # <<<<<<<<<<<<<< 
 *             else:
 *                 if isinstance(label[1], list):
 */
        __pyx_3 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_v_label); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
      }
      __pyx_L11:;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":129
 *                     stack.append(label)
 *             else:
 *                 if isinstance(label[1], list):             # <<<<<<<<<<<<<< 
 *                     stack.append(label[1])
 *                 else:
 */
      if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
        __pyx_1 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
        } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
        __pyx_1 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_1);
        } else {
        __pyx_2 = PyInt_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_1 = PyObject_GetItem(__pyx_v_label, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
      }
      __pyx_7 = PyObject_IsInstance(__pyx_1, ((PyObject*)&PyList_Type)); if (unlikely(__pyx_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      if (__pyx_7) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":130
 *             else:
 *                 if isinstance(label[1], list):
 *                     stack.append(label[1])             # <<<<<<<<<<<<<< 
 *                 else:
 *                     stack.append(label)
 */
        if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
          __pyx_3 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_3);
          } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
          __pyx_3 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_3);
          } else {
          __pyx_8 = PyInt_FromLong(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_3 = PyObject_GetItem(__pyx_v_label, __pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_8); __pyx_8 = 0;
        }
        __pyx_2 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":132
 *                     stack.append(label[1])
 *                 else:
 *                     stack.append(label)             # <<<<<<<<<<<<<< 
 *         else:
 *             if len(labels)>1:
 */
        __pyx_1 = __Pyx_PyObject_Append(__pyx_v_stack, __pyx_v_label); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
      }
      __pyx_L12:;
    }
    __pyx_L10:;
    __pyx_L2:;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":134
 *                     stack.append(label)
 *         else:
 *             if len(labels)>1:             # <<<<<<<<<<<<<< 
 *                 raise ValueError("Exit label `(None, ..)` missing in: %s"%labels)
 *             else:
 */
    __pyx_4 = PyObject_Length(__pyx_v_labels); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_7 = (__pyx_4 > 1);
    if (__pyx_7) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":135
 *         else:
 *             if len(labels)>1:
 *                 raise ValueError("Exit label `(None, ..)` missing in: %s"%labels)             # <<<<<<<<<<<<<< 
 *             else:
 *                 raise ValueError("No trace available")
 */
      __pyx_8 = PyNumber_Remainder(__pyx_k_5p, __pyx_v_labels); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_8);
      __pyx_8 = 0;
      __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1;}
      goto __pyx_L13;
    }
    /*else*/ {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":137
 *                 raise ValueError("Exit label `(None, ..)` missing in: %s"%labels)
 *             else:
 *                 raise ValueError("No trace available")             # <<<<<<<<<<<<<< 
 * 
 * 
 */
      __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_k_6p);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k_6p);
      __pyx_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      __Pyx_Raise(__pyx_8, 0, 0);
      Py_DECREF(__pyx_8); __pyx_8 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1;}
    }
    __pyx_L13:;
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_8);
  __Pyx_AddTraceback("tests.cyTrail.NFAMultiTrace.derive_tree");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_labels);
  Py_DECREF(__pyx_v_root);
  Py_DECREF(__pyx_v_stack);
  Py_DECREF(__pyx_v_reminder);
  Py_DECREF(__pyx_v_n);
  Py_DECREF(__pyx_v_label);
  Py_DECREF(__pyx_v_S);
  Py_DECREF(__pyx_v_entry);
  Py_DECREF(__pyx_v_sub);
  Py_DECREF(__pyx_v_link);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":148
 *     cdef object transitions
 *     cdef object cache
 *     def __init__(self, nfatable, nid, cache):             # <<<<<<<<<<<<<< 
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]
 */

static int __pyx_pf_5tests_7cyTrail_9NFACursor___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5tests_7cyTrail_9NFACursor___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nfatable = 0;
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_cache = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"nfatable","nid","cache",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 3)) {
    __pyx_v_nfatable = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_cache = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_nfatable, &__pyx_v_nid, &__pyx_v_cache))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.__init__");
  return -1;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":149
 *     cdef object cache
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]             # <<<<<<<<<<<<<< 
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])
 */
  __pyx_1 = PyObject_GetItem(__pyx_v_nfatable, __pyx_v_nid); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa);
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":150
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]             # <<<<<<<<<<<<<< 
 *         self.state   = set([self.nfa[2]])
 *         self.mtrace  = NFAMultiTrace(self.nfa[2])
 */
  if (PyList_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 3 && 3 < PyList_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_2 = PyList_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 3); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 3 && 3 < PyTuple_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_2 = PyTuple_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 3); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->transitions);
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->transitions = __pyx_2;
  __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":151
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])             # <<<<<<<<<<<<<< 
 *         self.mtrace  = NFAMultiTrace(self.nfa[2])
 *         self.terminated = False
 */
  if (PyList_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 2 && 2 < PyList_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_2 = PyList_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 2); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 2 && 2 < PyTuple_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_2 = PyTuple_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 2); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  __pyx_1 = PyList_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_1, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_1));
  __pyx_1 = 0;
  __pyx_1 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->state);
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->state = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":152
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])
 *         self.mtrace  = NFAMultiTrace(self.nfa[2])             # <<<<<<<<<<<<<< 
 *         self.terminated = False
 *         self.cache = cache
 */
  if (PyList_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 2 && 2 < PyList_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_1 = PyList_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 2); Py_INCREF(__pyx_1);
    } else if (PyTuple_CheckExact(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa) && 0 <= 2 && 2 < PyTuple_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa)) {
    __pyx_1 = PyTuple_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, 2); Py_INCREF(__pyx_1);
    } else {
    __pyx_2 = PyInt_FromLong(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_1 = PyObject_GetItem(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->nfa, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
  __pyx_1 = 0;
  __pyx_1 = PyObject_Call(((PyObject*)__pyx_ptype_5tests_7cyTrail_NFAMultiTrace), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_5tests_7cyTrail_NFAMultiTrace))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace));
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace = ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":153
 *         self.state   = set([self.nfa[2]])
 *         self.mtrace  = NFAMultiTrace(self.nfa[2])
 *         self.terminated = False             # <<<<<<<<<<<<<< 
 *         self.cache = cache
 * 
 */
  Py_INCREF(Py_False);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->terminated);
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->terminated = Py_False;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":154
 *         self.mtrace  = NFAMultiTrace(self.nfa[2])
 *         self.terminated = False
 *         self.cache = cache             # <<<<<<<<<<<<<< 
 * 
 * 
 */
  Py_INCREF(__pyx_v_cache);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->cache);
  ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->cache = __pyx_v_cache;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":157
 * 
 * 
 *     def derive_tree(self, sub_trees):             # <<<<<<<<<<<<<< 
 *         return self.mtrace.derive_tree(sub_trees)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_derive_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_sub_trees); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_derive_tree(PyObject *__pyx_v_self, PyObject *__pyx_v_sub_trees) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":158
 * 
 *     def derive_tree(self, sub_trees):
 *         return self.mtrace.derive_tree(sub_trees)             # <<<<<<<<<<<<<< 
 * 
 *     def node_sequence(self):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace->__pyx_vtab)->derive_tree(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace, __pyx_v_sub_trees); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.derive_tree");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":160
 *         return self.mtrace.derive_tree(sub_trees)
 * 
 *     def node_sequence(self):             # <<<<<<<<<<<<<< 
 *         return self.mtrace.node_sequence()
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_node_sequence(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_node_sequence(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":161
 * 
 *     def node_sequence(self):
 *         return self.mtrace.node_sequence()             # <<<<<<<<<<<<<< 
 * 
 *     def set_token(self, tok):
 */
  __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace), __pyx_n_node_sequence); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.node_sequence");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":163
 *         return self.mtrace.node_sequence()
 * 
 *     def set_token(self, tok):             # <<<<<<<<<<<<<< 
 *         self.mtrace.set_token(tok)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_set_token(PyObject *__pyx_v_self, PyObject *__pyx_v_tok); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_set_token(PyObject *__pyx_v_self, PyObject *__pyx_v_tok) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":164
 * 
 *     def set_token(self, tok):
 *         self.mtrace.set_token(tok)             # <<<<<<<<<<<<<< 
 * 
 *     def terminate(self):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace->__pyx_vtab)->set_token(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace, __pyx_v_tok); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.set_token");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":166
 *         self.mtrace.set_token(tok)
 * 
 *     def terminate(self):             # <<<<<<<<<<<<<< 
 *         self.mtrace.terminate()
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_terminate(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_terminate(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":167
 * 
 *     def terminate(self):
 *         self.mtrace.terminate()             # <<<<<<<<<<<<<< 
 * 
 *     def set_nonterminal(self, nt):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace->__pyx_vtab)->terminate(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.terminate");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":169
 *         self.mtrace.terminate()
 * 
 *     def set_nonterminal(self, nt):             # <<<<<<<<<<<<<< 
 *         self.mtrace.set_nonterminal(nt)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_set_nonterminal(PyObject *__pyx_v_self, PyObject *__pyx_v_nt); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_set_nonterminal(PyObject *__pyx_v_self, PyObject *__pyx_v_nt) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":170
 * 
 *     def set_nonterminal(self, nt):
 *         self.mtrace.set_nonterminal(nt)             # <<<<<<<<<<<<<< 
 * 
 *     def move(self, nid, tok):
 */
  __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->mtrace), __pyx_n_set_nonterminal); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_INCREF(__pyx_v_nt);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_nt);
  __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.set_nonterminal");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":172
 *         self.mtrace.set_nonterminal(nt)
 * 
 *     def move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         return self._move(nid, tok)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor_move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_tok = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"nid","tok",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 2)) {
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_tok = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_nid, &__pyx_v_tok))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.move");
  return NULL;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":173
 * 
 *     def move(self, nid, tok):
 *         return self._move(nid, tok)             # <<<<<<<<<<<<<< 
 * 
 *     cpdef _move(self, nid, tok):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->__pyx_vtab)->_move(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self), __pyx_v_nid, __pyx_v_tok); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.move");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":175
 *         return self._move(nid, tok)
 * 
 *     cpdef _move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         if nid is None:
 *             if self.terminated:
 */

static PyObject *__pyx_n_add;

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_5tests_7cyTrail_9NFACursor__move(struct __pyx_obj_5tests_7cyTrail_NFACursor *__pyx_v_self, PyObject *__pyx_v_nid, PyObject *__pyx_v_tok) {
  PyObject *__pyx_v_stateset;
  PyObject *__pyx_v_state;
  PyObject *__pyx_v_follow;
  PyObject *__pyx_v_S;
  PyObject *__pyx_v_selection;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  Py_ssize_t __pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  int __pyx_7;
  Py_ssize_t __pyx_8 = 0;
  PyObject *__pyx_9 = 0;
  __pyx_v_stateset = Py_None; Py_INCREF(Py_None);
  __pyx_v_state = Py_None; Py_INCREF(Py_None);
  __pyx_v_follow = Py_None; Py_INCREF(Py_None);
  __pyx_v_S = Py_None; Py_INCREF(Py_None);
  __pyx_v_selection = Py_None; Py_INCREF(Py_None);
  __pyx_v_s = Py_None; Py_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) __pyx_skip_dispatch = 0;
  /* Check if overriden in Python */
  else if (unlikely(((PyObject *)__pyx_v_self)->ob_type->tp_dictoffset != 0)) {
    __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n__move); if (unlikely(!((PyObject *)__pyx_v_self))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!(strcmp(__pyx_1->ob_type->tp_name, "builtin_function_or_method") == 0) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5tests_7cyTrail_9NFACursor__move)) {
      __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_nid);
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_nid);
      Py_INCREF(__pyx_v_tok);
      PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_tok);
      __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
      __pyx_r = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":176
 * 
 *     cpdef _move(self, nid, tok):
 *         if nid is None:             # <<<<<<<<<<<<<< 
 *             if self.terminated:
 *                 raise ValueError(str(nid))
 */
  __pyx_4 = (__pyx_v_nid == Py_None);
  if (__pyx_4) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":177
 *     cpdef _move(self, nid, tok):
 *         if nid is None:
 *             if self.terminated:             # <<<<<<<<<<<<<< 
 *                 raise ValueError(str(nid))
 *             self.mtrace.update(None, self.state)
 */
    __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->terminated); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_4) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":178
 *         if nid is None:
 *             if self.terminated:
 *                 raise ValueError(str(nid))             # <<<<<<<<<<<<<< 
 *             self.mtrace.update(None, self.state)
 *             self.terminated = True
 */
      __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_nid);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_nid);
      __pyx_2 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
      __pyx_2 = 0;
      __pyx_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
      __Pyx_Raise(__pyx_1, 0, 0);
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":179
 *             if self.terminated:
 *                 raise ValueError(str(nid))
 *             self.mtrace.update(None, self.state)             # <<<<<<<<<<<<<< 
 *             self.terminated = True
 *             return set()
 */
    __pyx_2 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->mtrace->__pyx_vtab)->update(__pyx_v_self->mtrace, Py_None, __pyx_v_self->state); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":180
 *                 raise ValueError(str(nid))
 *             self.mtrace.update(None, self.state)
 *             self.terminated = True             # <<<<<<<<<<<<<< 
 *             return set()
 *         stateset = set()
 */
    Py_INCREF(Py_True);
    Py_DECREF(__pyx_v_self->terminated);
    __pyx_v_self->terminated = Py_True;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":181
 *             self.mtrace.update(None, self.state)
 *             self.terminated = True
 *             return set()             # <<<<<<<<<<<<<< 
 *         stateset = set()
 *         for state in self.state:
 */
    __pyx_3 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_r = __pyx_3;
    __pyx_3 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":182
 *             self.terminated = True
 *             return set()
 *         stateset = set()             # <<<<<<<<<<<<<< 
 *         for state in self.state:
 *             if state[0] == nid:
 */
  __pyx_1 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_stateset);
  __pyx_v_stateset = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":183
 *             return set()
 *         stateset = set()
 *         for state in self.state:             # <<<<<<<<<<<<<< 
 *             if state[0] == nid:
 *                 follow = self.cache.get(state)
 */
  if (PyList_CheckExact(__pyx_v_self->state)) { __pyx_5 = 0; __pyx_2 = __pyx_v_self->state; Py_INCREF(__pyx_2); }
  else { __pyx_2 = PyObject_GetIter(__pyx_v_self->state); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_2)) { if (__pyx_5 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_5++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_2);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_state);
    __pyx_v_state = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":184
 *         stateset = set()
 *         for state in self.state:
 *             if state[0] == nid:             # <<<<<<<<<<<<<< 
 *                 follow = self.cache.get(state)
 *                 if not follow:
 */
    if (PyList_CheckExact(__pyx_v_state) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_state)) {
      __pyx_3 = PyList_GET_ITEM(__pyx_v_state, 0); Py_INCREF(__pyx_3);
      } else if (PyTuple_CheckExact(__pyx_v_state) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_state)) {
      __pyx_3 = PyTuple_GET_ITEM(__pyx_v_state, 0); Py_INCREF(__pyx_3);
      } else {
      __pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
    }
    __pyx_1 = PyObject_RichCompare(__pyx_3, __pyx_v_nid, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_4) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":185
 *         for state in self.state:
 *             if state[0] == nid:
 *                 follow = self.cache.get(state)             # <<<<<<<<<<<<<< 
 *                 if not follow:
 *                     follow = self.get_next_state(state)
 */
      __pyx_3 = PyObject_GetAttr(__pyx_v_self->cache, __pyx_n_get); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_state);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_state);
      __pyx_6 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      Py_DECREF(__pyx_v_follow);
      __pyx_v_follow = __pyx_6;
      __pyx_6 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":186
 *             if state[0] == nid:
 *                 follow = self.cache.get(state)
 *                 if not follow:             # <<<<<<<<<<<<<< 
 *                     follow = self.get_next_state(state)
 *                     self.cache[state] = follow
 */
      __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_follow); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_7 = (!__pyx_4);
      if (__pyx_7) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":187
 *                 follow = self.cache.get(state)
 *                 if not follow:
 *                     follow = self.get_next_state(state)             # <<<<<<<<<<<<<< 
 *                     self.cache[state] = follow
 *                 for S in follow:
 */
        __pyx_3 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *)__pyx_v_self->__pyx_vtab)->get_next_state(__pyx_v_self, __pyx_v_state); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_v_follow);
        __pyx_v_follow = __pyx_3;
        __pyx_3 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":188
 *                 if not follow:
 *                     follow = self.get_next_state(state)
 *                     self.cache[state] = follow             # <<<<<<<<<<<<<< 
 *                 for S in follow:
 *                     stateset.add(S[-1])
 */
        if (PyObject_SetItem(__pyx_v_self->cache, __pyx_v_state, __pyx_v_follow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1;}
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":189
 *                     follow = self.get_next_state(state)
 *                     self.cache[state] = follow
 *                 for S in follow:             # <<<<<<<<<<<<<< 
 *                     stateset.add(S[-1])
 *                 self.mtrace.update(state, follow)
 */
      if (PyList_CheckExact(__pyx_v_follow)) { __pyx_8 = 0; __pyx_1 = __pyx_v_follow; Py_INCREF(__pyx_1); }
      else { __pyx_1 = PyObject_GetIter(__pyx_v_follow); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1;} }
      for (;;) {
        if (PyList_CheckExact(__pyx_1)) { if (__pyx_8 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_6 = PyList_GET_ITEM(__pyx_1, __pyx_8++); Py_INCREF(__pyx_6); }
        else {
          __pyx_6 = PyIter_Next(__pyx_1);
          if (!__pyx_6) {
            break;
          }
        }
        Py_DECREF(__pyx_v_S);
        __pyx_v_S = __pyx_6;
        __pyx_6 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":190
 *                     self.cache[state] = follow
 *                 for S in follow:
 *                     stateset.add(S[-1])             # <<<<<<<<<<<<<< 
 *                 self.mtrace.update(state, follow)
 *         self.mtrace.commit()
 */
        __pyx_3 = PyObject_GetAttr(__pyx_v_stateset, __pyx_n_add); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
        if (PyList_CheckExact(__pyx_v_S) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_S)) {
          __pyx_9 = PyList_GET_ITEM(__pyx_v_S, -1); Py_INCREF(__pyx_9);
          } else if (PyTuple_CheckExact(__pyx_v_S) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_S)) {
          __pyx_9 = PyTuple_GET_ITEM(__pyx_v_S, -1); Py_INCREF(__pyx_9);
          } else {
          __pyx_6 = PyInt_FromLong(-1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_9 = PyObject_GetItem(__pyx_v_S, __pyx_6); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_6); __pyx_6 = 0;
        }
        __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_6, 0, __pyx_9);
        __pyx_9 = 0;
        __pyx_9 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_6), NULL); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        Py_DECREF(((PyObject *)__pyx_6)); __pyx_6 = 0;
        Py_DECREF(__pyx_9); __pyx_9 = 0;
      }
      Py_DECREF(__pyx_1); __pyx_1 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":191
 *                 for S in follow:
 *                     stateset.add(S[-1])
 *                 self.mtrace.update(state, follow)             # <<<<<<<<<<<<<< 
 *         self.mtrace.commit()
 *         self.state = stateset
 */
      __pyx_3 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->mtrace->__pyx_vtab)->update(__pyx_v_self->mtrace, __pyx_v_state, __pyx_v_follow); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":192
 *                     stateset.add(S[-1])
 *                 self.mtrace.update(state, follow)
 *         self.mtrace.commit()             # <<<<<<<<<<<<<< 
 *         self.state = stateset
 *         selection = set()
 */
  __pyx_6 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace *)__pyx_v_self->mtrace->__pyx_vtab)->commit(__pyx_v_self->mtrace); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_6); __pyx_6 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":193
 *                 self.mtrace.update(state, follow)
 *         self.mtrace.commit()
 *         self.state = stateset             # <<<<<<<<<<<<<< 
 *         selection = set()
 *         for s in stateset:
 */
  Py_INCREF(__pyx_v_stateset);
  Py_DECREF(__pyx_v_self->state);
  __pyx_v_self->state = __pyx_v_stateset;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":194
 *         self.mtrace.commit()
 *         self.state = stateset
 *         selection = set()             # <<<<<<<<<<<<<< 
 *         for s in stateset:
 *             selection.add(s[0])
 */
  __pyx_9 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_selection);
  __pyx_v_selection = __pyx_9;
  __pyx_9 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":195
 *         self.state = stateset
 *         selection = set()
 *         for s in stateset:             # <<<<<<<<<<<<<< 
 *             selection.add(s[0])
 *         return selection
 */
  if (PyList_CheckExact(__pyx_v_stateset)) { __pyx_8 = 0; __pyx_1 = __pyx_v_stateset; Py_INCREF(__pyx_1); }
  else { __pyx_1 = PyObject_GetIter(__pyx_v_stateset); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_1)) { if (__pyx_8 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_8++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_1);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":196
 *         selection = set()
 *         for s in stateset:
 *             selection.add(s[0])             # <<<<<<<<<<<<<< 
 *         return selection
 * 
 */
    __pyx_2 = PyObject_GetAttr(__pyx_v_selection, __pyx_n_add); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (PyList_CheckExact(__pyx_v_s) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_s)) {
      __pyx_9 = PyList_GET_ITEM(__pyx_v_s, 0); Py_INCREF(__pyx_9);
      } else if (PyTuple_CheckExact(__pyx_v_s) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_s)) {
      __pyx_9 = PyTuple_GET_ITEM(__pyx_v_s, 0); Py_INCREF(__pyx_9);
      } else {
      __pyx_6 = PyInt_FromLong(0); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_9 = PyObject_GetItem(__pyx_v_s, __pyx_6); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
    }
    __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_9);
    __pyx_9 = 0;
    __pyx_6 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
  }
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":197
 *         for s in stateset:
 *             selection.add(s[0])
 *         return selection             # <<<<<<<<<<<<<< 
 * 
 *     cdef get_next_state(self, state):
 */
  Py_INCREF(__pyx_v_selection);
  __pyx_r = __pyx_v_selection;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_9);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor._move");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_stateset);
  Py_DECREF(__pyx_v_state);
  Py_DECREF(__pyx_v_follow);
  Py_DECREF(__pyx_v_S);
  Py_DECREF(__pyx_v_selection);
  Py_DECREF(__pyx_v_s);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":175
 *         return self._move(nid, tok)
 * 
 *     cpdef _move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         if nid is None:
 *             if self.terminated:
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9NFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_tok = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"nid","tok",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 2)) {
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_tok = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_nid, &__pyx_v_tok))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.NFACursor._move");
  return NULL;
  __pyx_L3:;
  __pyx_1 = (__pyx_skip_dispatch = 1, ((struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *)((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self)->__pyx_vtab)->_move(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self), __pyx_v_nid, __pyx_v_tok)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor._move");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":199
 *         return selection
 * 
 *     cdef get_next_state(self, state):             # <<<<<<<<<<<<<< 
 *         next_states = []
 *         labels = self.transitions[state]
 */

static  PyObject *__pyx_f_5tests_7cyTrail_9NFACursor_get_next_state(struct __pyx_obj_5tests_7cyTrail_NFACursor *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_v_next_states;
  PyObject *__pyx_v_labels;
  PyObject *__pyx_v_label;
  PyObject *__pyx_v_S;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_ssize_t __pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  int __pyx_6;
  Py_ssize_t __pyx_7 = 0;
  __pyx_v_next_states = Py_None; Py_INCREF(Py_None);
  __pyx_v_labels = Py_None; Py_INCREF(Py_None);
  __pyx_v_label = Py_None; Py_INCREF(Py_None);
  __pyx_v_S = Py_None; Py_INCREF(Py_None);

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":200
 * 
 *     cdef get_next_state(self, state):
 *         next_states = []             # <<<<<<<<<<<<<< 
 *         labels = self.transitions[state]
 *         for label in labels:
 */
  __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_next_states);
  __pyx_v_next_states = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":201
 *     cdef get_next_state(self, state):
 *         next_states = []
 *         labels = self.transitions[state]             # <<<<<<<<<<<<<< 
 *         for label in labels:
 *             if label[1] == SKIP:
 */
  __pyx_1 = PyObject_GetItem(__pyx_v_self->transitions, __pyx_v_state); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_labels);
  __pyx_v_labels = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":202
 *         next_states = []
 *         labels = self.transitions[state]
 *         for label in labels:             # <<<<<<<<<<<<<< 
 *             if label[1] == SKIP:
 *                 for S in self.get_next_state(label):
 */
  if (PyList_CheckExact(__pyx_v_labels)) { __pyx_2 = 0; __pyx_1 = __pyx_v_labels; Py_INCREF(__pyx_1); }
  else { __pyx_1 = PyObject_GetIter(__pyx_v_labels); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_1);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_label);
    __pyx_v_label = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":203
 *         labels = self.transitions[state]
 *         for label in labels:
 *             if label[1] == SKIP:             # <<<<<<<<<<<<<< 
 *                 for S in self.get_next_state(label):
 *                     next_states.append([label]+S)
 */
    if (PyList_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyList_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_4);
      } else if (PyTuple_CheckExact(__pyx_v_label) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_label)) {
      __pyx_4 = PyTuple_GET_ITEM(__pyx_v_label, 1); Py_INCREF(__pyx_4);
      } else {
      __pyx_3 = PyInt_FromLong(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_4 = PyObject_GetItem(__pyx_v_label, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_SKIP); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = PyObject_RichCompare(__pyx_4, __pyx_3, Py_EQ); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_6 = __Pyx_PyObject_IsTrue(__pyx_5); if (unlikely(__pyx_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    if (__pyx_6) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":204
 *         for label in labels:
 *             if label[1] == SKIP:
 *                 for S in self.get_next_state(label):             # <<<<<<<<<<<<<< 
 *                     next_states.append([label]+S)
 *             else:
 */
      __pyx_4 = ((struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor *)__pyx_v_self->__pyx_vtab)->get_next_state(__pyx_v_self, __pyx_v_label); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1;}
      if (PyList_CheckExact(__pyx_4)) { __pyx_7 = 0; __pyx_3 = __pyx_4; Py_INCREF(__pyx_3); }
      else { __pyx_3 = PyObject_GetIter(__pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1;} }
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      for (;;) {
        if (PyList_CheckExact(__pyx_3)) { if (__pyx_7 >= PyList_GET_SIZE(__pyx_3)) break; __pyx_5 = PyList_GET_ITEM(__pyx_3, __pyx_7++); Py_INCREF(__pyx_5); }
        else {
          __pyx_5 = PyIter_Next(__pyx_3);
          if (!__pyx_5) {
            break;
          }
        }
        Py_DECREF(__pyx_v_S);
        __pyx_v_S = __pyx_5;
        __pyx_5 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":205
 *             if label[1] == SKIP:
 *                 for S in self.get_next_state(label):
 *                     next_states.append([label]+S)             # <<<<<<<<<<<<<< 
 *             else:
 *                 next_states.append([label])
 */
        __pyx_4 = PyList_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_INCREF(__pyx_v_label);
        PyList_SET_ITEM(__pyx_4, 0, __pyx_v_label);
        __pyx_5 = PyNumber_Add(((PyObject *)__pyx_4), __pyx_v_S); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
        __pyx_4 = __Pyx_PyObject_Append(__pyx_v_next_states, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_5); __pyx_5 = 0;
        Py_DECREF(__pyx_4); __pyx_4 = 0;
      }
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":207
 *                     next_states.append([label]+S)
 *             else:
 *                 next_states.append([label])             # <<<<<<<<<<<<<< 
 *         return next_states
 * 
 */
      __pyx_5 = PyList_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_label);
      PyList_SET_ITEM(__pyx_5, 0, __pyx_v_label);
      __pyx_4 = __Pyx_PyObject_Append(__pyx_v_next_states, ((PyObject *)__pyx_5)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
    }
    __pyx_L4:;
  }
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":208
 *             else:
 *                 next_states.append([label])
 *         return next_states             # <<<<<<<<<<<<<< 
 * 
 * 
 */
  Py_INCREF(__pyx_v_next_states);
  __pyx_r = __pyx_v_next_states;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("tests.cyTrail.NFACursor.get_next_state");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_next_states);
  Py_DECREF(__pyx_v_labels);
  Py_DECREF(__pyx_v_label);
  Py_DECREF(__pyx_v_S);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":212
 * 
 * cdef class SimpleNFACursor(NFACursor):
 *     def __init__(self, nfatable, nid, cache):             # <<<<<<<<<<<<<< 
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]
 */

static int __pyx_pf_5tests_7cyTrail_15SimpleNFACursor___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5tests_7cyTrail_15SimpleNFACursor___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nfatable = 0;
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_cache = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"nfatable","nid","cache",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 3)) {
    __pyx_v_nfatable = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_cache = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_nfatable, &__pyx_v_nid, &__pyx_v_cache))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor.__init__");
  return -1;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":213
 * cdef class SimpleNFACursor(NFACursor):
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]             # <<<<<<<<<<<<<< 
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])
 */
  __pyx_1 = PyObject_GetItem(__pyx_v_nfatable, __pyx_v_nid); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa);
  ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":214
 *     def __init__(self, nfatable, nid, cache):
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]             # <<<<<<<<<<<<<< 
 *         self.state   = set([self.nfa[2]])
 *         self.terminated = False
 */
  if (PyList_CheckExact(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa) && 0 <= 3 && 3 < PyList_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa)) {
    __pyx_2 = PyList_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, 3); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa) && 0 <= 3 && 3 < PyTuple_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa)) {
    __pyx_2 = PyTuple_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, 3); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.transitions);
  ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.transitions = __pyx_2;
  __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":215
 *         self.nfa = nfatable[nid]
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])             # <<<<<<<<<<<<<< 
 *         self.terminated = False
 *         self.cache = cache
 */
  if (PyList_CheckExact(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa) && 0 <= 2 && 2 < PyList_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa)) {
    __pyx_2 = PyList_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, 2); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa) && 0 <= 2 && 2 < PyTuple_GET_SIZE(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa)) {
    __pyx_2 = PyTuple_GET_ITEM(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, 2); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.nfa, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  __pyx_1 = PyList_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_1, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_1));
  __pyx_1 = 0;
  __pyx_1 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.state);
  ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.state = __pyx_1;
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":216
 *         self.transitions = self.nfa[3]
 *         self.state   = set([self.nfa[2]])
 *         self.terminated = False             # <<<<<<<<<<<<<< 
 *         self.cache = cache
 * 
 */
  Py_INCREF(Py_False);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.terminated);
  ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.terminated = Py_False;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":217
 *         self.state   = set([self.nfa[2]])
 *         self.terminated = False
 *         self.cache = cache             # <<<<<<<<<<<<<< 
 * 
 *     def move(self, nid, tok):
 */
  Py_INCREF(__pyx_v_cache);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.cache);
  ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.cache = __pyx_v_cache;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":219
 *         self.cache = cache
 * 
 *     def move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         return self._move(nid, tok)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_15SimpleNFACursor_move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_15SimpleNFACursor_move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_tok = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"nid","tok",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 2)) {
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_tok = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_nid, &__pyx_v_tok))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor.move");
  return NULL;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":220
 * 
 *     def move(self, nid, tok):
 *         return self._move(nid, tok)             # <<<<<<<<<<<<<< 
 * 
 *     cpdef _move(self, nid, tok):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor *)((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._move(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self), __pyx_v_nid, __pyx_v_tok); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor.move");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":222
 *         return self._move(nid, tok)
 * 
 *     cpdef _move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         if nid is None:
 *             if self.terminated:
 */

static PyObject *__pyx_pf_5tests_7cyTrail_15SimpleNFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_5tests_7cyTrail_15SimpleNFACursor__move(struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *__pyx_v_self, PyObject *__pyx_v_nid, PyObject *__pyx_v_tok) {
  PyObject *__pyx_v_stateset;
  PyObject *__pyx_v_state;
  PyObject *__pyx_v_follow;
  PyObject *__pyx_v_S;
  PyObject *__pyx_v_selection;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  Py_ssize_t __pyx_5 = 0;
  Py_ssize_t __pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  __pyx_v_stateset = Py_None; Py_INCREF(Py_None);
  __pyx_v_state = Py_None; Py_INCREF(Py_None);
  __pyx_v_follow = Py_None; Py_INCREF(Py_None);
  __pyx_v_S = Py_None; Py_INCREF(Py_None);
  __pyx_v_selection = Py_None; Py_INCREF(Py_None);
  __pyx_v_s = Py_None; Py_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) __pyx_skip_dispatch = 0;
  /* Check if overriden in Python */
  else if (unlikely(((PyObject *)__pyx_v_self)->ob_type->tp_dictoffset != 0)) {
    __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n__move); if (unlikely(!((PyObject *)__pyx_v_self))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!(strcmp(__pyx_1->ob_type->tp_name, "builtin_function_or_method") == 0) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5tests_7cyTrail_15SimpleNFACursor__move)) {
      __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_nid);
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_nid);
      Py_INCREF(__pyx_v_tok);
      PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_tok);
      __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
      __pyx_r = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":223
 * 
 *     cpdef _move(self, nid, tok):
 *         if nid is None:             # <<<<<<<<<<<<<< 
 *             if self.terminated:
 *                 raise ValueError(str(nid))
 */
  __pyx_4 = (__pyx_v_nid == Py_None);
  if (__pyx_4) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":224
 *     cpdef _move(self, nid, tok):
 *         if nid is None:
 *             if self.terminated:             # <<<<<<<<<<<<<< 
 *                 raise ValueError(str(nid))
 *             self.terminated = True
 */
    __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->__pyx_base.terminated); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_4) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":225
 *         if nid is None:
 *             if self.terminated:
 *                 raise ValueError(str(nid))             # <<<<<<<<<<<<<< 
 *             self.terminated = True
 *             return set()
 */
      __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_nid);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_nid);
      __pyx_2 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
      __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
      __pyx_2 = 0;
      __pyx_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
      __Pyx_Raise(__pyx_1, 0, 0);
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":226
 *             if self.terminated:
 *                 raise ValueError(str(nid))
 *             self.terminated = True             # <<<<<<<<<<<<<< 
 *             return set()
 *         stateset = set()
 */
    Py_INCREF(Py_True);
    Py_DECREF(__pyx_v_self->__pyx_base.terminated);
    __pyx_v_self->__pyx_base.terminated = Py_True;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":227
 *                 raise ValueError(str(nid))
 *             self.terminated = True
 *             return set()             # <<<<<<<<<<<<<< 
 *         stateset = set()
 *         for state in self.state:
 */
    __pyx_2 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":228
 *             self.terminated = True
 *             return set()
 *         stateset = set()             # <<<<<<<<<<<<<< 
 *         for state in self.state:
 *             if state[0] == nid:
 */
  __pyx_3 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_stateset);
  __pyx_v_stateset = __pyx_3;
  __pyx_3 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":229
 *             return set()
 *         stateset = set()
 *         for state in self.state:             # <<<<<<<<<<<<<< 
 *             if state[0] == nid:
 *                 follow = self.get_next_state(state)
 */
  if (PyList_CheckExact(__pyx_v_self->__pyx_base.state)) { __pyx_5 = 0; __pyx_1 = __pyx_v_self->__pyx_base.state; Py_INCREF(__pyx_1); }
  else { __pyx_1 = PyObject_GetIter(__pyx_v_self->__pyx_base.state); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_1)) { if (__pyx_5 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_2 = PyList_GET_ITEM(__pyx_1, __pyx_5++); Py_INCREF(__pyx_2); }
    else {
      __pyx_2 = PyIter_Next(__pyx_1);
      if (!__pyx_2) {
        break;
      }
    }
    Py_DECREF(__pyx_v_state);
    __pyx_v_state = __pyx_2;
    __pyx_2 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":230
 *         stateset = set()
 *         for state in self.state:
 *             if state[0] == nid:             # <<<<<<<<<<<<<< 
 *                 follow = self.get_next_state(state)
 *                 for S in follow:
 */
    if (PyList_CheckExact(__pyx_v_state) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_state)) {
      __pyx_2 = PyList_GET_ITEM(__pyx_v_state, 0); Py_INCREF(__pyx_2);
      } else if (PyTuple_CheckExact(__pyx_v_state) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_state)) {
      __pyx_2 = PyTuple_GET_ITEM(__pyx_v_state, 0); Py_INCREF(__pyx_2);
      } else {
      __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
    }
    __pyx_3 = PyObject_RichCompare(__pyx_2, __pyx_v_nid, Py_EQ); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_4) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":231
 *         for state in self.state:
 *             if state[0] == nid:
 *                 follow = self.get_next_state(state)             # <<<<<<<<<<<<<< 
 *                 for S in follow:
 *                     stateset.add(S[-1])
 */
      __pyx_2 = ((struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_next_state(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self), __pyx_v_state); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_v_follow);
      __pyx_v_follow = __pyx_2;
      __pyx_2 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":232
 *             if state[0] == nid:
 *                 follow = self.get_next_state(state)
 *                 for S in follow:             # <<<<<<<<<<<<<< 
 *                     stateset.add(S[-1])
 *         self.state = stateset
 */
      if (PyList_CheckExact(__pyx_v_follow)) { __pyx_6 = 0; __pyx_3 = __pyx_v_follow; Py_INCREF(__pyx_3); }
      else { __pyx_3 = PyObject_GetIter(__pyx_v_follow); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1;} }
      for (;;) {
        if (PyList_CheckExact(__pyx_3)) { if (__pyx_6 >= PyList_GET_SIZE(__pyx_3)) break; __pyx_2 = PyList_GET_ITEM(__pyx_3, __pyx_6++); Py_INCREF(__pyx_2); }
        else {
          __pyx_2 = PyIter_Next(__pyx_3);
          if (!__pyx_2) {
            break;
          }
        }
        Py_DECREF(__pyx_v_S);
        __pyx_v_S = __pyx_2;
        __pyx_2 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":233
 *                 follow = self.get_next_state(state)
 *                 for S in follow:
 *                     stateset.add(S[-1])             # <<<<<<<<<<<<<< 
 *         self.state = stateset
 *         selection = set()
 */
        __pyx_2 = PyObject_GetAttr(__pyx_v_stateset, __pyx_n_add); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
        if (PyList_CheckExact(__pyx_v_S) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_S)) {
          __pyx_8 = PyList_GET_ITEM(__pyx_v_S, -1); Py_INCREF(__pyx_8);
          } else if (PyTuple_CheckExact(__pyx_v_S) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_S)) {
          __pyx_8 = PyTuple_GET_ITEM(__pyx_v_S, -1); Py_INCREF(__pyx_8);
          } else {
          __pyx_7 = PyInt_FromLong(-1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_8 = PyObject_GetItem(__pyx_v_S, __pyx_7); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_7); __pyx_7 = 0;
        }
        __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_7, 0, __pyx_8);
        __pyx_8 = 0;
        __pyx_8 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0;
        Py_DECREF(__pyx_8); __pyx_8 = 0;
      }
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":234
 *                 for S in follow:
 *                     stateset.add(S[-1])
 *         self.state = stateset             # <<<<<<<<<<<<<< 
 *         selection = set()
 *         for s in stateset:
 */
  Py_INCREF(__pyx_v_stateset);
  Py_DECREF(__pyx_v_self->__pyx_base.state);
  __pyx_v_self->__pyx_base.state = __pyx_v_stateset;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":235
 *                     stateset.add(S[-1])
 *         self.state = stateset
 *         selection = set()             # <<<<<<<<<<<<<< 
 *         for s in stateset:
 *             selection.add(s[0])
 */
  __pyx_2 = PyObject_Call(((PyObject*)&PySet_Type), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_selection);
  __pyx_v_selection = __pyx_2;
  __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":236
 *         self.state = stateset
 *         selection = set()
 *         for s in stateset:             # <<<<<<<<<<<<<< 
 *             selection.add(s[0])
 *         return selection
 */
  if (PyList_CheckExact(__pyx_v_stateset)) { __pyx_6 = 0; __pyx_7 = __pyx_v_stateset; Py_INCREF(__pyx_7); }
  else { __pyx_7 = PyObject_GetIter(__pyx_v_stateset); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_7)) { if (__pyx_6 >= PyList_GET_SIZE(__pyx_7)) break; __pyx_8 = PyList_GET_ITEM(__pyx_7, __pyx_6++); Py_INCREF(__pyx_8); }
    else {
      __pyx_8 = PyIter_Next(__pyx_7);
      if (!__pyx_8) {
        break;
      }
    }
    Py_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_8;
    __pyx_8 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":237
 *         selection = set()
 *         for s in stateset:
 *             selection.add(s[0])             # <<<<<<<<<<<<<< 
 *         return selection
 * 
 */
    __pyx_3 = PyObject_GetAttr(__pyx_v_selection, __pyx_n_add); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (PyList_CheckExact(__pyx_v_s) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_s)) {
      __pyx_2 = PyList_GET_ITEM(__pyx_v_s, 0); Py_INCREF(__pyx_2);
      } else if (PyTuple_CheckExact(__pyx_v_s) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_s)) {
      __pyx_2 = PyTuple_GET_ITEM(__pyx_v_s, 0); Py_INCREF(__pyx_2);
      } else {
      __pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_2 = PyObject_GetItem(__pyx_v_s, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
    }
    __pyx_8 = PyTuple_New(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_8), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  Py_DECREF(__pyx_7); __pyx_7 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":238
 *         for s in stateset:
 *             selection.add(s[0])
 *         return selection             # <<<<<<<<<<<<<< 
 * 
 * cdef class LexerUnit:
 */
  Py_INCREF(__pyx_v_selection);
  __pyx_r = __pyx_v_selection;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor._move");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_stateset);
  Py_DECREF(__pyx_v_state);
  Py_DECREF(__pyx_v_follow);
  Py_DECREF(__pyx_v_S);
  Py_DECREF(__pyx_v_selection);
  Py_DECREF(__pyx_v_s);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":222
 *         return self._move(nid, tok)
 * 
 *     cpdef _move(self, nid, tok):             # <<<<<<<<<<<<<< 
 *         if nid is None:
 *             if self.terminated:
 */

static PyObject *__pyx_pf_5tests_7cyTrail_15SimpleNFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_15SimpleNFACursor__move(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nid = 0;
  PyObject *__pyx_v_tok = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"nid","tok",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 2)) {
    __pyx_v_nid = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_tok = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_nid, &__pyx_v_tok))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor._move");
  return NULL;
  __pyx_L3:;
  __pyx_1 = (__pyx_skip_dispatch = 1, ((struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor *)((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base._move(((struct __pyx_obj_5tests_7cyTrail_NFACursor *)__pyx_v_self), __pyx_v_nid, __pyx_v_tok)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.SimpleNFACursor._move");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":246
 *     cdef object tok_name
 * 
 *     def __init__(self, tok_name, sym_name, intron, tabwidth):             # <<<<<<<<<<<<<< 
 *         self.tok_name = tok_name
 *         self.sym_name = sym_name
 */

static int __pyx_pf_5tests_7cyTrail_9LexerUnit___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5tests_7cyTrail_9LexerUnit___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tok_name = 0;
  PyObject *__pyx_v_sym_name = 0;
  PyObject *__pyx_v_intron = 0;
  PyObject *__pyx_v_tabwidth = 0;
  int __pyx_r;
  int __pyx_1;
  static char *__pyx_argnames[] = {"tok_name","sym_name","intron","tabwidth",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 4)) {
    __pyx_v_tok_name = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_sym_name = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_intron = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_tabwidth = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_tok_name, &__pyx_v_sym_name, &__pyx_v_intron, &__pyx_v_tabwidth))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit.__init__");
  return -1;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":247
 * 
 *     def __init__(self, tok_name, sym_name, intron, tabwidth):
 *         self.tok_name = tok_name             # <<<<<<<<<<<<<< 
 *         self.sym_name = sym_name
 *         self.intron   = intron
 */
  Py_INCREF(__pyx_v_tok_name);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->tok_name);
  ((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->tok_name = __pyx_v_tok_name;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":248
 *     def __init__(self, tok_name, sym_name, intron, tabwidth):
 *         self.tok_name = tok_name
 *         self.sym_name = sym_name             # <<<<<<<<<<<<<< 
 *         self.intron   = intron
 *         self.tabwidth = tabwidth
 */
  Py_INCREF(__pyx_v_sym_name);
  Py_DECREF(((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->sym_name);
  ((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->sym_name = __pyx_v_sym_name;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":249
 *         self.tok_name = tok_name
 *         self.sym_name = sym_name
 *         self.intron   = intron             # <<<<<<<<<<<<<< 
 *         self.tabwidth = tabwidth
 * 
 */
  __pyx_1 = __pyx_PyInt_int(__pyx_v_intron); if (unlikely((__pyx_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1;}
  ((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->intron = __pyx_1;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":250
 *         self.sym_name = sym_name
 *         self.intron   = intron
 *         self.tabwidth = tabwidth             # <<<<<<<<<<<<<< 
 * 
 *     def handle_unit(self,unit, terminals, pseudo_token, last_token):
 */
  __pyx_1 = __pyx_PyInt_int(__pyx_v_tabwidth); if (unlikely((__pyx_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1;}
  ((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->tabwidth = __pyx_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":252
 *         self.tabwidth = tabwidth
 * 
 *     def handle_unit(self,unit, terminals, pseudo_token, last_token):             # <<<<<<<<<<<<<< 
 *         return self._handle_unit(unit, terminals, pseudo_token, last_token)
 * 
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit_handle_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit_handle_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_unit = 0;
  PyObject *__pyx_v_terminals = 0;
  PyObject *__pyx_v_pseudo_token = 0;
  PyObject *__pyx_v_last_token = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"unit","terminals","pseudo_token","last_token",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 4)) {
    __pyx_v_unit = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_terminals = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_pseudo_token = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_last_token = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_unit, &__pyx_v_terminals, &__pyx_v_pseudo_token, &__pyx_v_last_token))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit.handle_unit");
  return NULL;
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":253
 * 
 *     def handle_unit(self,unit, terminals, pseudo_token, last_token):
 *         return self._handle_unit(unit, terminals, pseudo_token, last_token)             # <<<<<<<<<<<<<< 
 * 
 *     cpdef _handle_unit(self, unit, terminals, pseudo_token, last_token):
 */
  __pyx_1 = ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->__pyx_vtab)->_handle_unit(((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self), __pyx_v_unit, __pyx_v_terminals, __pyx_v_pseudo_token, __pyx_v_last_token); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit.handle_unit");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":255
 *         return self._handle_unit(unit, terminals, pseudo_token, last_token)
 * 
 *     cpdef _handle_unit(self, unit, terminals, pseudo_token, last_token):             # <<<<<<<<<<<<<< 
 *         cdef int nid, sub_nid, num, nd
 *         cdef int col_begin, col_end_old, line_begin, line_end_old, newlines
 */

static PyObject *__pyx_int_1;

static PyObject *__pyx_n_KeyError;
static PyObject *__pyx_n_join;
static PyObject *__pyx_n_replace;
static PyObject *__pyx_n_count;
static PyObject *__pyx_n_rfind;

static PyObject *__pyx_k_7p;
static PyObject *__pyx_k_8p;
static PyObject *__pyx_k_9p;
static PyObject *__pyx_k_10p;
static PyObject *__pyx_k_11p;
static PyObject *__pyx_k_12p;
static PyObject *__pyx_k_13p;
static PyObject *__pyx_k_14p;
static PyObject *__pyx_k_15p;
static PyObject *__pyx_k_16p;
static PyObject *__pyx_k_17p;
static PyObject *__pyx_k_18p;
static PyObject *__pyx_k_19p;
static PyObject *__pyx_k_20p;
static PyObject *__pyx_k_21p;
static PyObject *__pyx_k_22p;

static PyObject *__pyx_builtin_KeyError;

static char __pyx_k_7[] = "";
static char __pyx_k_8[] = "";
static char __pyx_k_9[] = "";
static char __pyx_k_10[] = "\t";
static char __pyx_k_11[] = " ";
static char __pyx_k_12[] = "\n";
static char __pyx_k_13[] = "";
static char __pyx_k_14[] = "\t";
static char __pyx_k_15[] = "\t";
static char __pyx_k_16[] = " ";
static char __pyx_k_17[] = "\n";
static char __pyx_k_18[] = "\n";
static char __pyx_k_19[] = "\n";
static char __pyx_k_20[] = "";
static char __pyx_k_21[] = "";
static char __pyx_k_22[] = "";

static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__handle_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  PyObject *__pyx_f_5tests_7cyTrail_9LexerUnit__handle_unit(struct __pyx_obj_5tests_7cyTrail_LexerUnit *__pyx_v_self, PyObject *__pyx_v_unit, PyObject *__pyx_v_terminals, PyObject *__pyx_v_pseudo_token, PyObject *__pyx_v_last_token) {
  int __pyx_v_nid;
  int __pyx_v_sub_nid;
  int __pyx_v_num;
  int __pyx_v_nd;
  int __pyx_v_col_begin;
  int __pyx_v_col_end_old;
  int __pyx_v_line_begin;
  int __pyx_v_line_end_old;
  int __pyx_v_newlines;
  PyObject *__pyx_v_sub_unit;
  PyObject *__pyx_v_node;
  PyObject *__pyx_v_line_begin_old;
  PyObject *__pyx_v_col_begin_old;
  PyObject *__pyx_v_l;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_col_end;
  PyObject *__pyx_v_line_end;
  PyObject *__pyx_v_intron;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_item_nd;
  PyObject *__pyx_v_item_s;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  int __pyx_5;
  Py_ssize_t __pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  PyObject *__pyx_9 = 0;
  __pyx_v_sub_unit = Py_None; Py_INCREF(Py_None);
  __pyx_v_node = Py_None; Py_INCREF(Py_None);
  __pyx_v_line_begin_old = Py_None; Py_INCREF(Py_None);
  __pyx_v_col_begin_old = Py_None; Py_INCREF(Py_None);
  __pyx_v_l = Py_None; Py_INCREF(Py_None);
  __pyx_v_s = Py_None; Py_INCREF(Py_None);
  __pyx_v_col_end = Py_None; Py_INCREF(Py_None);
  __pyx_v_line_end = Py_None; Py_INCREF(Py_None);
  __pyx_v_intron = Py_None; Py_INCREF(Py_None);
  __pyx_v_item = Py_None; Py_INCREF(Py_None);
  __pyx_v_item_nd = Py_None; Py_INCREF(Py_None);
  __pyx_v_item_s = Py_None; Py_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) __pyx_skip_dispatch = 0;
  /* Check if overriden in Python */
  else if (unlikely(((PyObject *)__pyx_v_self)->ob_type->tp_dictoffset != 0)) {
    __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n__handle_unit); if (unlikely(!((PyObject *)__pyx_v_self))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!(strcmp(__pyx_1->ob_type->tp_name, "builtin_function_or_method") == 0) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5tests_7cyTrail_9LexerUnit__handle_unit)) {
      __pyx_2 = PyTuple_New(4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_unit);
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_unit);
      Py_INCREF(__pyx_v_terminals);
      PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_terminals);
      Py_INCREF(__pyx_v_pseudo_token);
      PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_pseudo_token);
      Py_INCREF(__pyx_v_last_token);
      PyTuple_SET_ITEM(__pyx_2, 3, __pyx_v_last_token);
      __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
      __pyx_r = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":258
 *         cdef int nid, sub_nid, num, nd
 *         cdef int col_begin, col_end_old, line_begin, line_end_old, newlines
 *         sub_unit = unit             # <<<<<<<<<<<<<< 
 *         nid = unit[1][0]
 *         while True:
 */
  Py_INCREF(__pyx_v_unit);
  Py_DECREF(__pyx_v_sub_unit);
  __pyx_v_sub_unit = __pyx_v_unit;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":259
 *         cdef int col_begin, col_end_old, line_begin, line_end_old, newlines
 *         sub_unit = unit
 *         nid = unit[1][0]             # <<<<<<<<<<<<<< 
 *         while True:
 *             sub_nid = sub_unit[0]
 */
  if (PyList_CheckExact(__pyx_v_unit) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_unit)) {
    __pyx_2 = PyList_GET_ITEM(__pyx_v_unit, 1); Py_INCREF(__pyx_2);
    } else if (PyTuple_CheckExact(__pyx_v_unit) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_unit)) {
    __pyx_2 = PyTuple_GET_ITEM(__pyx_v_unit, 1); Py_INCREF(__pyx_2);
    } else {
    __pyx_1 = PyInt_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(__pyx_v_unit, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }
  if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) {
    __pyx_1 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_1);
    } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) {
    __pyx_1 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_1);
    } else {
    __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_1 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = __pyx_PyInt_int(__pyx_1); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_v_nid = __pyx_4;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":260
 *         sub_unit = unit
 *         nid = unit[1][0]
 *         while True:             # <<<<<<<<<<<<<< 
 *             sub_nid = sub_unit[0]
 *             if sub_nid-256 in terminals:
 */
  while (1) {
    __pyx_5 = __Pyx_PyObject_IsTrue(Py_True); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!__pyx_5) break;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":261
 *         nid = unit[1][0]
 *         while True:
 *             sub_nid = sub_unit[0]             # <<<<<<<<<<<<<< 
 *             if sub_nid-256 in terminals:
 *                 if sub_nid not in pseudo_token:
 */
    if (PyList_CheckExact(__pyx_v_sub_unit) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_sub_unit)) {
      __pyx_3 = PyList_GET_ITEM(__pyx_v_sub_unit, 0); Py_INCREF(__pyx_3);
      } else if (PyTuple_CheckExact(__pyx_v_sub_unit) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_sub_unit)) {
      __pyx_3 = PyTuple_GET_ITEM(__pyx_v_sub_unit, 0); Py_INCREF(__pyx_3);
      } else {
      __pyx_2 = PyInt_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_GetItem(__pyx_v_sub_unit, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
    }
    __pyx_4 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_v_sub_nid = __pyx_4;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":262
 *         while True:
 *             sub_nid = sub_unit[0]
 *             if sub_nid-256 in terminals:             # <<<<<<<<<<<<<< 
 *                 if sub_nid not in pseudo_token:
 *                     nid = sub_unit[0]
 */
    __pyx_1 = PyInt_FromLong((__pyx_v_sub_nid - 256)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = (PySequence_Contains(__pyx_v_terminals, __pyx_1)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":263
 *             sub_nid = sub_unit[0]
 *             if sub_nid-256 in terminals:
 *                 if sub_nid not in pseudo_token:             # <<<<<<<<<<<<<< 
 *                     nid = sub_unit[0]
 *             if len(sub_unit) == 2:
 */
      __pyx_2 = PyInt_FromLong(__pyx_v_sub_nid); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_5 = (!PySequence_Contains(__pyx_v_pseudo_token, __pyx_2)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      if (__pyx_5) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":264
 *             if sub_nid-256 in terminals:
 *                 if sub_nid not in pseudo_token:
 *                     nid = sub_unit[0]             # <<<<<<<<<<<<<< 
 *             if len(sub_unit) == 2:
 *                 sub_unit = sub_unit[1]
 */
        if (PyList_CheckExact(__pyx_v_sub_unit) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_sub_unit)) {
          __pyx_1 = PyList_GET_ITEM(__pyx_v_sub_unit, 0); Py_INCREF(__pyx_1);
          } else if (PyTuple_CheckExact(__pyx_v_sub_unit) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_sub_unit)) {
          __pyx_1 = PyTuple_GET_ITEM(__pyx_v_sub_unit, 0); Py_INCREF(__pyx_1);
          } else {
          __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_1 = PyObject_GetItem(__pyx_v_sub_unit, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_3); __pyx_3 = 0;
        }
        __pyx_4 = __pyx_PyInt_int(__pyx_1); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_v_nid = __pyx_4;
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":265
 *                 if sub_nid not in pseudo_token:
 *                     nid = sub_unit[0]
 *             if len(sub_unit) == 2:             # <<<<<<<<<<<<<< 
 *                 sub_unit = sub_unit[1]
 *             else:
 */
    __pyx_6 = PyObject_Length(__pyx_v_sub_unit); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = (__pyx_6 == 2);
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":266
 *                     nid = sub_unit[0]
 *             if len(sub_unit) == 2:
 *                 sub_unit = sub_unit[1]             # <<<<<<<<<<<<<< 
 *             else:
 *                 break
 */
      if (PyList_CheckExact(__pyx_v_sub_unit) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_sub_unit)) {
        __pyx_3 = PyList_GET_ITEM(__pyx_v_sub_unit, 1); Py_INCREF(__pyx_3);
        } else if (PyTuple_CheckExact(__pyx_v_sub_unit) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_sub_unit)) {
        __pyx_3 = PyTuple_GET_ITEM(__pyx_v_sub_unit, 1); Py_INCREF(__pyx_3);
        } else {
        __pyx_2 = PyInt_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyObject_GetItem(__pyx_v_sub_unit, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
      }
      Py_DECREF(__pyx_v_sub_unit);
      __pyx_v_sub_unit = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L6;
    }
    /*else*/ {
      goto __pyx_L3;
    }
    __pyx_L6:;
  }
  __pyx_L3:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":269
 *             else:
 *                 break
 *         try:             # <<<<<<<<<<<<<< 
 *             node = (nid, self.tok_name.get(nid,"")+self.sym_name.get(nid,""))
 *         except KeyError:
 */
  /*try:*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":270
 *                 break
 *         try:
 *             node = (nid, self.tok_name.get(nid,"")+self.sym_name.get(nid,""))             # <<<<<<<<<<<<<< 
 *         except KeyError:
 *             node = (nid, '')
 */
    __pyx_1 = PyInt_FromLong(__pyx_v_nid); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_2 = PyObject_GetAttr(__pyx_v_self->tok_name, __pyx_n_get); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_3 = PyInt_FromLong(__pyx_v_nid); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_3);
    Py_INCREF(__pyx_k_7p);
    PyTuple_SET_ITEM(__pyx_7, 1, __pyx_k_7p);
    __pyx_3 = 0;
    __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0;
    __pyx_2 = PyObject_GetAttr(__pyx_v_self->sym_name, __pyx_n_get); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_7 = PyInt_FromLong(__pyx_v_nid); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __pyx_8 = PyTuple_New(2); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_7);
    Py_INCREF(__pyx_k_8p);
    PyTuple_SET_ITEM(__pyx_8, 1, __pyx_k_8p);
    __pyx_7 = 0;
    __pyx_7 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_8), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0;
    __pyx_2 = PyNumber_Add(__pyx_3, __pyx_7); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_8 = PyTuple_New(2); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L7;}
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_1);
    PyTuple_SET_ITEM(__pyx_8, 1, __pyx_2);
    __pyx_1 = 0;
    __pyx_2 = 0;
    Py_DECREF(__pyx_v_node);
    __pyx_v_node = ((PyObject *)__pyx_8);
    __pyx_8 = 0;
  }
  goto __pyx_L8;
  __pyx_L7:;
  Py_XDECREF(__pyx_3); __pyx_3 = 0;
  Py_XDECREF(__pyx_7); __pyx_7 = 0;
  Py_XDECREF(__pyx_1); __pyx_1 = 0;
  Py_XDECREF(__pyx_2); __pyx_2 = 0;
  Py_XDECREF(__pyx_8); __pyx_8 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":271
 *         try:
 *             node = (nid, self.tok_name.get(nid,"")+self.sym_name.get(nid,""))
 *         except KeyError:             # <<<<<<<<<<<<<< 
 *             node = (nid, '')
 *         (line_begin_old, line_end_old) = last_token[2]
 */
  __pyx_4 = PyErr_ExceptionMatches(__pyx_builtin_KeyError);
  if (__pyx_4) {
    __Pyx_AddTraceback("tests.cyTrail._handle_unit");
    if (__Pyx_GetException(&__pyx_3, &__pyx_7, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1;}

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":272
 *             node = (nid, self.tok_name.get(nid,"")+self.sym_name.get(nid,""))
 *         except KeyError:
 *             node = (nid, '')             # <<<<<<<<<<<<<< 
 *         (line_begin_old, line_end_old) = last_token[2]
 *         (col_begin_old, col_end_old)   = last_token[-1]
 */
    __pyx_2 = PyInt_FromLong(__pyx_v_nid); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_8 = PyTuple_New(2); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_2);
    Py_INCREF(__pyx_k_9p);
    PyTuple_SET_ITEM(__pyx_8, 1, __pyx_k_9p);
    __pyx_2 = 0;
    Py_DECREF(__pyx_v_node);
    __pyx_v_node = ((PyObject *)__pyx_8);
    __pyx_8 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    goto __pyx_L8;
  }
  goto __pyx_L1;
  __pyx_L8:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":273
 *         except KeyError:
 *             node = (nid, '')
 *         (line_begin_old, line_end_old) = last_token[2]             # <<<<<<<<<<<<<< 
 *         (col_begin_old, col_end_old)   = last_token[-1]
 *         col_begin  = col_end_old
 */
  if (PyList_CheckExact(__pyx_v_last_token) && 0 <= 2 && 2 < PyList_GET_SIZE(__pyx_v_last_token)) {
    __pyx_8 = PyList_GET_ITEM(__pyx_v_last_token, 2); Py_INCREF(__pyx_8);
    } else if (PyTuple_CheckExact(__pyx_v_last_token) && 0 <= 2 && 2 < PyTuple_GET_SIZE(__pyx_v_last_token)) {
    __pyx_8 = PyTuple_GET_ITEM(__pyx_v_last_token, 2); Py_INCREF(__pyx_8);
    } else {
    __pyx_2 = PyInt_FromLong(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_8 = PyObject_GetItem(__pyx_v_last_token, __pyx_2); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  if (PyTuple_CheckExact(__pyx_8) && PyTuple_GET_SIZE(__pyx_8) == 2) {
    PyObject* tuple = __pyx_8;
    __pyx_7 = PyTuple_GET_ITEM(tuple, 0);
    Py_INCREF(__pyx_7);
    Py_DECREF(__pyx_v_line_begin_old);
    __pyx_v_line_begin_old = __pyx_7;
    __pyx_7 = 0;
    __pyx_1 = PyTuple_GET_ITEM(tuple, 1);
    Py_INCREF(__pyx_1);
    __pyx_4 = __pyx_PyInt_int(__pyx_1); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_v_line_end_old = __pyx_4;
    Py_DECREF(__pyx_8); __pyx_8 = 0;
  }
  else {
    __pyx_3 = PyObject_GetIter(__pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_8); __pyx_8 = 0;
    __pyx_7 = __Pyx_UnpackItem(__pyx_3, 0); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_v_line_begin_old);
    __pyx_v_line_begin_old = __pyx_7;
    __pyx_7 = 0;
    __pyx_1 = __Pyx_UnpackItem(__pyx_3, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_4 = __pyx_PyInt_int(__pyx_1); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_v_line_end_old = __pyx_4;
    if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":274
 *             node = (nid, '')
 *         (line_begin_old, line_end_old) = last_token[2]
 *         (col_begin_old, col_end_old)   = last_token[-1]             # <<<<<<<<<<<<<< 
 *         col_begin  = col_end_old
 *         line_begin = line_end_old
 */
  if (PyList_CheckExact(__pyx_v_last_token) && 0 <= -1 && -1 < PyList_GET_SIZE(__pyx_v_last_token)) {
    __pyx_7 = PyList_GET_ITEM(__pyx_v_last_token, -1); Py_INCREF(__pyx_7);
    } else if (PyTuple_CheckExact(__pyx_v_last_token) && 0 <= -1 && -1 < PyTuple_GET_SIZE(__pyx_v_last_token)) {
    __pyx_7 = PyTuple_GET_ITEM(__pyx_v_last_token, -1); Py_INCREF(__pyx_7);
    } else {
    __pyx_2 = PyInt_FromLong(-1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_7 = PyObject_GetItem(__pyx_v_last_token, __pyx_2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  if (PyTuple_CheckExact(__pyx_7) && PyTuple_GET_SIZE(__pyx_7) == 2) {
    PyObject* tuple = __pyx_7;
    __pyx_8 = PyTuple_GET_ITEM(tuple, 0);
    Py_INCREF(__pyx_8);
    Py_DECREF(__pyx_v_col_begin_old);
    __pyx_v_col_begin_old = __pyx_8;
    __pyx_8 = 0;
    __pyx_3 = PyTuple_GET_ITEM(tuple, 1);
    Py_INCREF(__pyx_3);
    __pyx_4 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_v_col_end_old = __pyx_4;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
  }
  else {
    __pyx_1 = PyObject_GetIter(__pyx_7); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_8 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_v_col_begin_old);
    __pyx_v_col_begin_old = __pyx_8;
    __pyx_8 = 0;
    __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_4 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_v_col_end_old = __pyx_4;
    if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":275
 *         (line_begin_old, line_end_old) = last_token[2]
 *         (col_begin_old, col_end_old)   = last_token[-1]
 *         col_begin  = col_end_old             # <<<<<<<<<<<<<< 
 *         line_begin = line_end_old
 * 
 */
  __pyx_v_col_begin = __pyx_v_col_end_old;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":276
 *         (col_begin_old, col_end_old)   = last_token[-1]
 *         col_begin  = col_end_old
 *         line_begin = line_end_old             # <<<<<<<<<<<<<< 
 * 
 *         l = self._tostr_lst(sub_unit)
 */
  __pyx_v_line_begin = __pyx_v_line_end_old;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":278
 *         line_begin = line_end_old
 * 
 *         l = self._tostr_lst(sub_unit)             # <<<<<<<<<<<<<< 
 *         newlines = 0
 *         if len(l) == 1:
 */
  __pyx_2 = ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)__pyx_v_self->__pyx_vtab)->_tostr_lst(__pyx_v_self, __pyx_v_sub_unit); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_l);
  __pyx_v_l = __pyx_2;
  __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":279
 * 
 *         l = self._tostr_lst(sub_unit)
 *         newlines = 0             # <<<<<<<<<<<<<< 
 *         if len(l) == 1:
 *             s = l[0]
 */
  __pyx_v_newlines = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":280
 *         l = self._tostr_lst(sub_unit)
 *         newlines = 0
 *         if len(l) == 1:             # <<<<<<<<<<<<<< 
 *             s = l[0]
 *             num = 1
 */
  __pyx_6 = PyObject_Length(__pyx_v_l); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_5 = (__pyx_6 == 1);
  if (__pyx_5) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":281
 *         newlines = 0
 *         if len(l) == 1:
 *             s = l[0]             # <<<<<<<<<<<<<< 
 *             num = 1
 *             if s == '\t':
 */
    if (PyList_CheckExact(__pyx_v_l) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_l)) {
      __pyx_3 = PyList_GET_ITEM(__pyx_v_l, 0); Py_INCREF(__pyx_3);
      } else if (PyTuple_CheckExact(__pyx_v_l) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_l)) {
      __pyx_3 = PyTuple_GET_ITEM(__pyx_v_l, 0); Py_INCREF(__pyx_3);
      } else {
      __pyx_8 = PyInt_FromLong(0); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyObject_GetItem(__pyx_v_l, __pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_8); __pyx_8 = 0;
    }
    Py_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":282
 *         if len(l) == 1:
 *             s = l[0]
 *             num = 1             # <<<<<<<<<<<<<< 
 *             if s == '\t':
 *                 s = " "*self.tabwidth
 */
    __pyx_v_num = 1;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":283
 *             s = l[0]
 *             num = 1
 *             if s == '\t':             # <<<<<<<<<<<<<< 
 *                 s = " "*self.tabwidth
 *                 num = self.tabwidth
 */
    __pyx_7 = PyObject_RichCompare(__pyx_v_s, __pyx_k_10p, Py_EQ); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_7); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":284
 *             num = 1
 *             if s == '\t':
 *                 s = " "*self.tabwidth             # <<<<<<<<<<<<<< 
 *                 num = self.tabwidth
 *             elif s == '\n':
 */
      __pyx_1 = PyInt_FromLong(__pyx_v_self->tabwidth); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_2 = PyNumber_Multiply(__pyx_k_11p, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_2;
      __pyx_2 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":285
 *             if s == '\t':
 *                 s = " "*self.tabwidth
 *                 num = self.tabwidth             # <<<<<<<<<<<<<< 
 *             elif s == '\n':
 *                 newlines = 1
 */
      __pyx_v_num = __pyx_v_self->tabwidth;
      goto __pyx_L10;
    }

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":286
 *                 s = " "*self.tabwidth
 *                 num = self.tabwidth
 *             elif s == '\n':             # <<<<<<<<<<<<<< 
 *                 newlines = 1
 *         else:
 */
    __pyx_8 = PyObject_RichCompare(__pyx_v_s, __pyx_k_12p, Py_EQ); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_8); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_8); __pyx_8 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":287
 *                 num = self.tabwidth
 *             elif s == '\n':
 *                 newlines = 1             # <<<<<<<<<<<<<< 
 *         else:
 *             s = ''.join(l)
 */
      __pyx_v_newlines = 1;
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":289
 *                 newlines = 1
 *         else:
 *             s = ''.join(l)             # <<<<<<<<<<<<<< 
 *             if '\t' in s:
 *                 s = s.replace("\t", " "*self.tabwidth)
 */
    __pyx_3 = PyObject_GetAttr(__pyx_k_13p, __pyx_n_join); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_l);
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_v_l);
    __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0;
    Py_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_1;
    __pyx_1 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":290
 *         else:
 *             s = ''.join(l)
 *             if '\t' in s:             # <<<<<<<<<<<<<< 
 *                 s = s.replace("\t", " "*self.tabwidth)
 *             if '\n' in s:
 */
    __pyx_5 = (PySequence_Contains(__pyx_v_s, __pyx_k_14p)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":291
 *             s = ''.join(l)
 *             if '\t' in s:
 *                 s = s.replace("\t", " "*self.tabwidth)             # <<<<<<<<<<<<<< 
 *             if '\n' in s:
 *                 newlines = s.count("\n")
 */
      __pyx_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_replace); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_8 = PyInt_FromLong(__pyx_v_self->tabwidth); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyNumber_Multiply(__pyx_k_16p, __pyx_8); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_8); __pyx_8 = 0;
      __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_k_15p);
      PyTuple_SET_ITEM(__pyx_7, 0, __pyx_k_15p);
      PyTuple_SET_ITEM(__pyx_7, 1, __pyx_3);
      __pyx_3 = 0;
      __pyx_1 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0;
      Py_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_1;
      __pyx_1 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":292
 *             if '\t' in s:
 *                 s = s.replace("\t", " "*self.tabwidth)
 *             if '\n' in s:             # <<<<<<<<<<<<<< 
 *                 newlines = s.count("\n")
 *             num = len(s)
 */
    __pyx_5 = (PySequence_Contains(__pyx_v_s, __pyx_k_17p)); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":293
 *                 s = s.replace("\t", " "*self.tabwidth)
 *             if '\n' in s:
 *                 newlines = s.count("\n")             # <<<<<<<<<<<<<< 
 *             num = len(s)
 *         if newlines:
 */
      __pyx_8 = PyObject_GetAttr(__pyx_v_s, __pyx_n_count); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_k_18p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_18p);
      __pyx_2 = PyObject_Call(__pyx_8, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_8); __pyx_8 = 0;
      Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
      __pyx_4 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_v_newlines = __pyx_4;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":294
 *             if '\n' in s:
 *                 newlines = s.count("\n")
 *             num = len(s)             # <<<<<<<<<<<<<< 
 *         if newlines:
 *             col_end = len(s) - s.rfind("\n")-1
 */
    __pyx_6 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_v_num = __pyx_6;
  }
  __pyx_L9:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":295
 *                 newlines = s.count("\n")
 *             num = len(s)
 *         if newlines:             # <<<<<<<<<<<<<< 
 *             col_end = len(s) - s.rfind("\n")-1
 *         else:
 */
  __pyx_4 = __pyx_v_newlines;
  if (__pyx_4) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":296
 *             num = len(s)
 *         if newlines:
 *             col_end = len(s) - s.rfind("\n")-1             # <<<<<<<<<<<<<< 
 *         else:
 *             col_end = col_begin+num
 */
    __pyx_6 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_7 = PyInt_FromSsize_t(__pyx_6); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_1 = PyObject_GetAttr(__pyx_v_s, __pyx_n_rfind); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_8 = PyTuple_New(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_k_19p);
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_k_19p);
    __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_8), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0;
    __pyx_2 = PyNumber_Subtract(__pyx_7, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_1 = PyNumber_Subtract(__pyx_2, __pyx_int_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_v_col_end);
    __pyx_v_col_end = __pyx_1;
    __pyx_1 = 0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":298
 *             col_end = len(s) - s.rfind("\n")-1
 *         else:
 *             col_end = col_begin+num             # <<<<<<<<<<<<<< 
 *         line_end = line_end_old+newlines
 *         if nid == self.intron:
 */
    __pyx_8 = PyInt_FromLong((__pyx_v_col_begin + __pyx_v_num)); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_v_col_end);
    __pyx_v_col_end = __pyx_8;
    __pyx_8 = 0;
  }
  __pyx_L13:;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":299
 *         else:
 *             col_end = col_begin+num
 *         line_end = line_end_old+newlines             # <<<<<<<<<<<<<< 
 *         if nid == self.intron:
 *             intron = []
 */
  __pyx_7 = PyInt_FromLong((__pyx_v_line_end_old + __pyx_v_newlines)); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_line_end);
  __pyx_v_line_end = __pyx_7;
  __pyx_7 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":300
 *             col_end = col_begin+num
 *         line_end = line_end_old+newlines
 *         if nid == self.intron:             # <<<<<<<<<<<<<< 
 *             intron = []
 *             for item in unit[1]:
 */
  __pyx_5 = (__pyx_v_nid == __pyx_v_self->intron);
  if (__pyx_5) {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":301
 *         line_end = line_end_old+newlines
 *         if nid == self.intron:
 *             intron = []             # <<<<<<<<<<<<<< 
 *             for item in unit[1]:
 *                 if type(item) == list:
 */
    __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_v_intron);
    __pyx_v_intron = ((PyObject *)__pyx_3);
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":302
 *         if nid == self.intron:
 *             intron = []
 *             for item in unit[1]:             # <<<<<<<<<<<<<< 
 *                 if type(item) == list:
 *                     nd = item[0]
 */
    if (PyList_CheckExact(__pyx_v_unit) && 0 <= 1 && 1 < PyList_GET_SIZE(__pyx_v_unit)) {
      __pyx_1 = PyList_GET_ITEM(__pyx_v_unit, 1); Py_INCREF(__pyx_1);
      } else if (PyTuple_CheckExact(__pyx_v_unit) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_unit)) {
      __pyx_1 = PyTuple_GET_ITEM(__pyx_v_unit, 1); Py_INCREF(__pyx_1);
      } else {
      __pyx_2 = PyInt_FromLong(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1;}
      __pyx_1 = PyObject_GetItem(__pyx_v_unit, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
    }
    if (PyList_CheckExact(__pyx_1)) { __pyx_6 = 0; __pyx_8 = __pyx_1; Py_INCREF(__pyx_8); }
    else { __pyx_8 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1;} }
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_8)) { if (__pyx_6 >= PyList_GET_SIZE(__pyx_8)) break; __pyx_7 = PyList_GET_ITEM(__pyx_8, __pyx_6++); Py_INCREF(__pyx_7); }
      else {
        __pyx_7 = PyIter_Next(__pyx_8);
        if (!__pyx_7) {
          break;
        }
      }
      Py_DECREF(__pyx_v_item);
      __pyx_v_item = __pyx_7;
      __pyx_7 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":303
 *             intron = []
 *             for item in unit[1]:
 *                 if type(item) == list:             # <<<<<<<<<<<<<< 
 *                     nd = item[0]
 *                     item_nd = (nd, self.tok_name.get(nd,"")+self.sym_name.get(nd,""))
 */
      __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_item);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_item);
      __pyx_2 = PyObject_Call(((PyObject*)&PyType_Type), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
      __pyx_1 = PyObject_RichCompare(__pyx_2, ((PyObject*)&PyList_Type), Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      if (__pyx_5) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":304
 *             for item in unit[1]:
 *                 if type(item) == list:
 *                     nd = item[0]             # <<<<<<<<<<<<<< 
 *                     item_nd = (nd, self.tok_name.get(nd,"")+self.sym_name.get(nd,""))
 *                     item_s  = ''.join(self._tostr_lst(item))
 */
        if (PyList_CheckExact(__pyx_v_item) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_v_item)) {
          __pyx_3 = PyList_GET_ITEM(__pyx_v_item, 0); Py_INCREF(__pyx_3);
          } else if (PyTuple_CheckExact(__pyx_v_item) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_item)) {
          __pyx_3 = PyTuple_GET_ITEM(__pyx_v_item, 0); Py_INCREF(__pyx_3);
          } else {
          __pyx_7 = PyInt_FromLong(0); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1;}
          __pyx_3 = PyObject_GetItem(__pyx_v_item, __pyx_7); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1;}
          Py_DECREF(__pyx_7); __pyx_7 = 0;
        }
        __pyx_4 = __pyx_PyInt_int(__pyx_3); if (unlikely((__pyx_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_v_nd = __pyx_4;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":305
 *                 if type(item) == list:
 *                     nd = item[0]
 *                     item_nd = (nd, self.tok_name.get(nd,"")+self.sym_name.get(nd,""))             # <<<<<<<<<<<<<< 
 *                     item_s  = ''.join(self._tostr_lst(item))
 *                     intron.append((item_nd, item_s))
 */
        __pyx_2 = PyInt_FromLong(__pyx_v_nd); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_1 = PyObject_GetAttr(__pyx_v_self->tok_name, __pyx_n_get); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_7 = PyInt_FromLong(__pyx_v_nd); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_7);
        Py_INCREF(__pyx_k_20p);
        PyTuple_SET_ITEM(__pyx_3, 1, __pyx_k_20p);
        __pyx_7 = 0;
        __pyx_7 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
        __pyx_1 = PyObject_GetAttr(__pyx_v_self->sym_name, __pyx_n_get); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyInt_FromLong(__pyx_v_nd); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_9 = PyTuple_New(2); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_9, 0, __pyx_3);
        Py_INCREF(__pyx_k_21p);
        PyTuple_SET_ITEM(__pyx_9, 1, __pyx_k_21p);
        __pyx_3 = 0;
        __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_9), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(((PyObject *)__pyx_9)); __pyx_9 = 0;
        __pyx_1 = PyNumber_Add(__pyx_7, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_9 = PyTuple_New(2); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_9, 0, __pyx_2);
        PyTuple_SET_ITEM(__pyx_9, 1, __pyx_1);
        __pyx_2 = 0;
        __pyx_1 = 0;
        Py_DECREF(__pyx_v_item_nd);
        __pyx_v_item_nd = ((PyObject *)__pyx_9);
        __pyx_9 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":306
 *                     nd = item[0]
 *                     item_nd = (nd, self.tok_name.get(nd,"")+self.sym_name.get(nd,""))
 *                     item_s  = ''.join(self._tostr_lst(item))             # <<<<<<<<<<<<<< 
 *                     intron.append((item_nd, item_s))
 *             return [node, intron, (line_begin, line_end), (col_begin, col_end)]
 */
        __pyx_7 = PyObject_GetAttr(__pyx_k_22p, __pyx_n_join); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)__pyx_v_self->__pyx_vtab)->_tostr_lst(__pyx_v_self, __pyx_v_item); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
        __pyx_3 = 0;
        __pyx_1 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
        Py_DECREF(__pyx_v_item_s);
        __pyx_v_item_s = __pyx_1;
        __pyx_1 = 0;

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":307
 *                     item_nd = (nd, self.tok_name.get(nd,"")+self.sym_name.get(nd,""))
 *                     item_s  = ''.join(self._tostr_lst(item))
 *                     intron.append((item_nd, item_s))             # <<<<<<<<<<<<<< 
 *             return [node, intron, (line_begin, line_end), (col_begin, col_end)]
 *         else:
 */
        __pyx_9 = PyTuple_New(2); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_INCREF(__pyx_v_item_nd);
        PyTuple_SET_ITEM(__pyx_9, 0, __pyx_v_item_nd);
        Py_INCREF(__pyx_v_item_s);
        PyTuple_SET_ITEM(__pyx_9, 1, __pyx_v_item_s);
        __pyx_3 = __Pyx_PyObject_Append(__pyx_v_intron, ((PyObject *)__pyx_9)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(((PyObject *)__pyx_9)); __pyx_9 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        goto __pyx_L17;
      }
      __pyx_L17:;
    }
    Py_DECREF(__pyx_8); __pyx_8 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":308
 *                     item_s  = ''.join(self._tostr_lst(item))
 *                     intron.append((item_nd, item_s))
 *             return [node, intron, (line_begin, line_end), (col_begin, col_end)]             # <<<<<<<<<<<<<< 
 *         else:
 *             return [node, s, (line_begin, line_end), (col_begin, col_end)]
 */
    __pyx_7 = PyInt_FromLong(__pyx_v_line_begin); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_7);
    Py_INCREF(__pyx_v_line_end);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_line_end);
    __pyx_7 = 0;
    __pyx_1 = PyInt_FromLong(__pyx_v_col_begin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_9 = PyTuple_New(2); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_9, 0, __pyx_1);
    Py_INCREF(__pyx_v_col_end);
    PyTuple_SET_ITEM(__pyx_9, 1, __pyx_v_col_end);
    __pyx_1 = 0;
    __pyx_3 = PyList_New(4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_node);
    PyList_SET_ITEM(__pyx_3, 0, __pyx_v_node);
    Py_INCREF(__pyx_v_intron);
    PyList_SET_ITEM(__pyx_3, 1, __pyx_v_intron);
    PyList_SET_ITEM(__pyx_3, 2, ((PyObject *)__pyx_2));
    PyList_SET_ITEM(__pyx_3, 3, ((PyObject *)__pyx_9));
    __pyx_2 = 0;
    __pyx_9 = 0;
    __pyx_r = ((PyObject *)__pyx_3);
    __pyx_3 = 0;
    goto __pyx_L0;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":310
 *             return [node, intron, (line_begin, line_end), (col_begin, col_end)]
 *         else:
 *             return [node, s, (line_begin, line_end), (col_begin, col_end)]             # <<<<<<<<<<<<<< 
 * 
 *     cpdef _tostr_lst(self, node):
 */
    __pyx_8 = PyInt_FromLong(__pyx_v_line_begin); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_8);
    Py_INCREF(__pyx_v_line_end);
    PyTuple_SET_ITEM(__pyx_7, 1, __pyx_v_line_end);
    __pyx_8 = 0;
    __pyx_1 = PyInt_FromLong(__pyx_v_col_begin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
    Py_INCREF(__pyx_v_col_end);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_col_end);
    __pyx_1 = 0;
    __pyx_9 = PyList_New(4); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_node);
    PyList_SET_ITEM(__pyx_9, 0, __pyx_v_node);
    Py_INCREF(__pyx_v_s);
    PyList_SET_ITEM(__pyx_9, 1, __pyx_v_s);
    PyList_SET_ITEM(__pyx_9, 2, ((PyObject *)__pyx_7));
    PyList_SET_ITEM(__pyx_9, 3, ((PyObject *)__pyx_2));
    __pyx_7 = 0;
    __pyx_2 = 0;
    __pyx_r = ((PyObject *)__pyx_9);
    __pyx_9 = 0;
    goto __pyx_L0;
  }
  __pyx_L14:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  Py_XDECREF(__pyx_9);
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit._handle_unit");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_sub_unit);
  Py_DECREF(__pyx_v_node);
  Py_DECREF(__pyx_v_line_begin_old);
  Py_DECREF(__pyx_v_col_begin_old);
  Py_DECREF(__pyx_v_l);
  Py_DECREF(__pyx_v_s);
  Py_DECREF(__pyx_v_col_end);
  Py_DECREF(__pyx_v_line_end);
  Py_DECREF(__pyx_v_intron);
  Py_DECREF(__pyx_v_item);
  Py_DECREF(__pyx_v_item_nd);
  Py_DECREF(__pyx_v_item_s);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":255
 *         return self._handle_unit(unit, terminals, pseudo_token, last_token)
 * 
 *     cpdef _handle_unit(self, unit, terminals, pseudo_token, last_token):             # <<<<<<<<<<<<<< 
 *         cdef int nid, sub_nid, num, nd
 *         cdef int col_begin, col_end_old, line_begin, line_end_old, newlines
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__handle_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__handle_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_unit = 0;
  PyObject *__pyx_v_terminals = 0;
  PyObject *__pyx_v_pseudo_token = 0;
  PyObject *__pyx_v_last_token = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"unit","terminals","pseudo_token","last_token",0};
  if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 4)) {
    __pyx_v_unit = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_terminals = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_pseudo_token = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_last_token = PyTuple_GET_ITEM(__pyx_args, 3);
  }
  else {
    if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_unit, &__pyx_v_terminals, &__pyx_v_pseudo_token, &__pyx_v_last_token))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L2;}
  }
  goto __pyx_L3;
  __pyx_L2:;
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit._handle_unit");
  return NULL;
  __pyx_L3:;
  __pyx_1 = (__pyx_skip_dispatch = 1, ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->__pyx_vtab)->_handle_unit(((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self), __pyx_v_unit, __pyx_v_terminals, __pyx_v_pseudo_token, __pyx_v_last_token)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit._handle_unit");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":312
 *             return [node, s, (line_begin, line_end), (col_begin, col_end)]
 * 
 *     cpdef _tostr_lst(self, node):             # <<<<<<<<<<<<<< 
 *         l_s = []
 *         for item in node:
 */

static PyObject *__pyx_n_extend;

static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__tostr_lst(PyObject *__pyx_v_self, PyObject *__pyx_v_node); /*proto*/
static  PyObject *__pyx_f_5tests_7cyTrail_9LexerUnit__tostr_lst(struct __pyx_obj_5tests_7cyTrail_LexerUnit *__pyx_v_self, PyObject *__pyx_v_node) {
  PyObject *__pyx_v_l_s;
  PyObject *__pyx_v_item;
  PyObject *__pyx_v_l_r;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_ssize_t __pyx_4 = 0;
  int __pyx_5;
  PyObject *__pyx_6 = 0;
  __pyx_v_l_s = Py_None; Py_INCREF(Py_None);
  __pyx_v_item = Py_None; Py_INCREF(Py_None);
  __pyx_v_l_r = Py_None; Py_INCREF(Py_None);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) __pyx_skip_dispatch = 0;
  /* Check if overriden in Python */
  else if (unlikely(((PyObject *)__pyx_v_self)->ob_type->tp_dictoffset != 0)) {
    __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n__tostr_lst); if (unlikely(!((PyObject *)__pyx_v_self))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1;}
    if (!(strcmp(__pyx_1->ob_type->tp_name, "builtin_function_or_method") == 0) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5tests_7cyTrail_9LexerUnit__tostr_lst)) {
      __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_INCREF(__pyx_v_node);
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_node);
      __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
      __pyx_r = __pyx_3;
      __pyx_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":313
 * 
 *     cpdef _tostr_lst(self, node):
 *         l_s = []             # <<<<<<<<<<<<<< 
 *         for item in node:
 *             if type(item) == list:
 */
  __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1;}
  Py_DECREF(__pyx_v_l_s);
  __pyx_v_l_s = ((PyObject *)__pyx_1);
  __pyx_1 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":314
 *     cpdef _tostr_lst(self, node):
 *         l_s = []
 *         for item in node:             # <<<<<<<<<<<<<< 
 *             if type(item) == list:
 *                 l_r = self._tostr_lst(item)
 */
  if (PyList_CheckExact(__pyx_v_node)) { __pyx_4 = 0; __pyx_2 = __pyx_v_node; Py_INCREF(__pyx_2); }
  else { __pyx_2 = PyObject_GetIter(__pyx_v_node); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1;} }
  for (;;) {
    if (PyList_CheckExact(__pyx_2)) { if (__pyx_4 >= PyList_GET_SIZE(__pyx_2)) break; __pyx_3 = PyList_GET_ITEM(__pyx_2, __pyx_4++); Py_INCREF(__pyx_3); }
    else {
      __pyx_3 = PyIter_Next(__pyx_2);
      if (!__pyx_3) {
        break;
      }
    }
    Py_DECREF(__pyx_v_item);
    __pyx_v_item = __pyx_3;
    __pyx_3 = 0;

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":315
 *         l_s = []
 *         for item in node:
 *             if type(item) == list:             # <<<<<<<<<<<<<< 
 *                 l_r = self._tostr_lst(item)
 *                 if l_r:
 */
    __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_item);
    __pyx_3 = PyObject_Call(((PyObject*)&PyType_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    __pyx_1 = PyObject_RichCompare(__pyx_3, ((PyObject*)&PyList_Type), Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":316
 *         for item in node:
 *             if type(item) == list:
 *                 l_r = self._tostr_lst(item)             # <<<<<<<<<<<<<< 
 *                 if l_r:
 *                     l_s.extend(l_r)
 */
      __pyx_3 = ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)__pyx_v_self->__pyx_vtab)->_tostr_lst(__pyx_v_self, __pyx_v_item); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_v_l_r);
      __pyx_v_l_r = __pyx_3;
      __pyx_3 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":317
 *             if type(item) == list:
 *                 l_r = self._tostr_lst(item)
 *                 if l_r:             # <<<<<<<<<<<<<< 
 *                     l_s.extend(l_r)
 *             elif type(item) == str:
 */
      __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_v_l_r); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1;}
      if (__pyx_5) {

        /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":318
 *                 l_r = self._tostr_lst(item)
 *                 if l_r:
 *                     l_s.extend(l_r)             # <<<<<<<<<<<<<< 
 *             elif type(item) == str:
 *                 l_s.append(item)
 */
        __pyx_1 = PyObject_GetAttr(__pyx_v_l_s, __pyx_n_extend); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_INCREF(__pyx_v_l_r);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_l_r);
        __pyx_6 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
        Py_DECREF(__pyx_6); __pyx_6 = 0;
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }

    /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":319
 *                 if l_r:
 *                     l_s.extend(l_r)
 *             elif type(item) == str:             # <<<<<<<<<<<<<< 
 *                 l_s.append(item)
 *                 break
 */
    __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_INCREF(__pyx_v_item);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_item);
    __pyx_3 = PyObject_Call(((PyObject*)&PyType_Type), ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0;
    __pyx_6 = PyObject_RichCompare(__pyx_3, ((PyObject*)&PyString_Type), Py_EQ); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_5 = __Pyx_PyObject_IsTrue(__pyx_6); if (unlikely(__pyx_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    if (__pyx_5) {

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":320
 *                     l_s.extend(l_r)
 *             elif type(item) == str:
 *                 l_s.append(item)             # <<<<<<<<<<<<<< 
 *                 break
 *         return l_s
 */
      __pyx_1 = __Pyx_PyObject_Append(__pyx_v_l_s, __pyx_v_item); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;

      /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":321
 *             elif type(item) == str:
 *                 l_s.append(item)
 *                 break             # <<<<<<<<<<<<<< 
 *         return l_s
 * 
 */
      goto __pyx_L3;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }
  __pyx_L3:;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":322
 *                 l_s.append(item)
 *                 break
 *         return l_s             # <<<<<<<<<<<<<< 
 * 
 * 
 */
  Py_INCREF(__pyx_v_l_s);
  __pyx_r = __pyx_v_l_s;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit._tostr_lst");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_l_s);
  Py_DECREF(__pyx_v_item);
  Py_DECREF(__pyx_v_l_r);
  return __pyx_r;
}

/* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":312
 *             return [node, s, (line_begin, line_end), (col_begin, col_end)]
 * 
 *     cpdef _tostr_lst(self, node):             # <<<<<<<<<<<<<< 
 *         l_s = []
 *         for item in node:
 */

static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__tostr_lst(PyObject *__pyx_v_self, PyObject *__pyx_v_node); /*proto*/
static PyObject *__pyx_pf_5tests_7cyTrail_9LexerUnit__tostr_lst(PyObject *__pyx_v_self, PyObject *__pyx_v_node) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  __pyx_1 = (__pyx_skip_dispatch = 1, ((struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit *)((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self)->__pyx_vtab)->_tostr_lst(((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)__pyx_v_self), __pyx_v_node)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("tests.cyTrail.LexerUnit._tostr_lst");
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

static __Pyx_InternTabEntry __pyx_intern_tab[] = {
  {&__pyx_n_KeyError, "KeyError"},
  {&__pyx_n_RuntimeError, "RuntimeError"},
  {&__pyx_n_SKIP, "SKIP"},
  {&__pyx_n_ValueError, "ValueError"},
  {&__pyx_n___init__, "__init__"},
  {&__pyx_n__handle_unit, "_handle_unit"},
  {&__pyx_n__move, "_move"},
  {&__pyx_n__tostr_lst, "_tostr_lst"},
  {&__pyx_n_add, "add"},
  {&__pyx_n_append, "append"},
  {&__pyx_n_count, "count"},
  {&__pyx_n_derive_tree, "derive_tree"},
  {&__pyx_n_extend, "extend"},
  {&__pyx_n_get, "get"},
  {&__pyx_n_handle_unit, "handle_unit"},
  {&__pyx_n_join, "join"},
  {&__pyx_n_move, "move"},
  {&__pyx_n_node_sequence, "node_sequence"},
  {&__pyx_n_pop, "pop"},
  {&__pyx_n_replace, "replace"},
  {&__pyx_n_rfind, "rfind"},
  {&__pyx_n_set_nonterminal, "set_nonterminal"},
  {&__pyx_n_set_token, "set_token"},
  {&__pyx_n_terminate, "terminate"},
  {0, 0}
};

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_k_1p, __pyx_k_1, sizeof(__pyx_k_1), 0},
  {&__pyx_k_2p, __pyx_k_2, sizeof(__pyx_k_2), 0},
  {&__pyx_k_3p, __pyx_k_3, sizeof(__pyx_k_3), 0},
  {&__pyx_k_4p, __pyx_k_4, sizeof(__pyx_k_4), 0},
  {&__pyx_k_5p, __pyx_k_5, sizeof(__pyx_k_5), 0},
  {&__pyx_k_6p, __pyx_k_6, sizeof(__pyx_k_6), 0},
  {&__pyx_k_7p, __pyx_k_7, sizeof(__pyx_k_7), 0},
  {&__pyx_k_8p, __pyx_k_8, sizeof(__pyx_k_8), 0},
  {&__pyx_k_9p, __pyx_k_9, sizeof(__pyx_k_9), 0},
  {&__pyx_k_10p, __pyx_k_10, sizeof(__pyx_k_10), 0},
  {&__pyx_k_11p, __pyx_k_11, sizeof(__pyx_k_11), 0},
  {&__pyx_k_12p, __pyx_k_12, sizeof(__pyx_k_12), 0},
  {&__pyx_k_13p, __pyx_k_13, sizeof(__pyx_k_13), 0},
  {&__pyx_k_14p, __pyx_k_14, sizeof(__pyx_k_14), 0},
  {&__pyx_k_15p, __pyx_k_15, sizeof(__pyx_k_15), 0},
  {&__pyx_k_16p, __pyx_k_16, sizeof(__pyx_k_16), 0},
  {&__pyx_k_17p, __pyx_k_17, sizeof(__pyx_k_17), 0},
  {&__pyx_k_18p, __pyx_k_18, sizeof(__pyx_k_18), 0},
  {&__pyx_k_19p, __pyx_k_19, sizeof(__pyx_k_19), 0},
  {&__pyx_k_20p, __pyx_k_20, sizeof(__pyx_k_20), 0},
  {&__pyx_k_21p, __pyx_k_21, sizeof(__pyx_k_21), 0},
  {&__pyx_k_22p, __pyx_k_22, sizeof(__pyx_k_22), 0},
  {0, 0, 0, 0}
};

static PyObject *__pyx_tp_new_5tests_7cyTrail_NFATraceNode(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)o);
  p->parent = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)Py_None); Py_INCREF(Py_None);
  p->label = Py_None; Py_INCREF(Py_None);
  p->token = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5tests_7cyTrail_NFATraceNode(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *p = (struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)o;
  Py_XDECREF(((PyObject *)p->parent));
  Py_XDECREF(p->label);
  Py_XDECREF(p->token);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_5tests_7cyTrail_NFATraceNode(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *p = (struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)o;
  if (p->parent) {
    e = (*v)(((PyObject*)p->parent), a); if (e) return e;
  }
  if (p->label) {
    e = (*v)(p->label, a); if (e) return e;
  }
  if (p->token) {
    e = (*v)(p->token, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5tests_7cyTrail_NFATraceNode(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFATraceNode *p = (struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->parent);
  p->parent = ((struct __pyx_obj_5tests_7cyTrail_NFATraceNode *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->label);
  p->label = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->token);
  p->token = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_5tests_7cyTrail_NFATraceNode[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NFATraceNode = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NFATraceNode = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_NFATraceNode = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_NFATraceNode = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_5tests_7cyTrail_NFATraceNode = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "tests.cyTrail.NFATraceNode", /*tp_name*/
  sizeof(struct __pyx_obj_5tests_7cyTrail_NFATraceNode), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5tests_7cyTrail_NFATraceNode, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NFATraceNode, /*tp_as_number*/
  &__pyx_tp_as_sequence_NFATraceNode, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NFATraceNode, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NFATraceNode, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5tests_7cyTrail_NFATraceNode, /*tp_traverse*/
  __pyx_tp_clear_5tests_7cyTrail_NFATraceNode, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5tests_7cyTrail_NFATraceNode, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5tests_7cyTrail_12NFATraceNode___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5tests_7cyTrail_NFATraceNode, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace __pyx_vtable_5tests_7cyTrail_NFAMultiTrace;

static PyObject *__pyx_tp_new_5tests_7cyTrail_NFAMultiTrace(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)o);
  *(struct __pyx_vtabstruct_5tests_7cyTrail_NFAMultiTrace **)&p->__pyx_vtab = __pyx_vtabptr_5tests_7cyTrail_NFAMultiTrace;
  p->start = Py_None; Py_INCREF(Py_None);
  p->traces = Py_None; Py_INCREF(Py_None);
  p->new_traces = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5tests_7cyTrail_NFAMultiTrace(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *p = (struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)o;
  Py_XDECREF(p->start);
  Py_XDECREF(p->traces);
  Py_XDECREF(p->new_traces);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_5tests_7cyTrail_NFAMultiTrace(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *p = (struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)o;
  if (p->start) {
    e = (*v)(p->start, a); if (e) return e;
  }
  if (p->traces) {
    e = (*v)(p->traces, a); if (e) return e;
  }
  if (p->new_traces) {
    e = (*v)(p->new_traces, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5tests_7cyTrail_NFAMultiTrace(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *p = (struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->start);
  p->start = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->traces);
  p->traces = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->new_traces);
  p->new_traces = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_5tests_7cyTrail_NFAMultiTrace[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NFAMultiTrace = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NFAMultiTrace = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_NFAMultiTrace = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_NFAMultiTrace = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_5tests_7cyTrail_NFAMultiTrace = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "tests.cyTrail.NFAMultiTrace", /*tp_name*/
  sizeof(struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5tests_7cyTrail_NFAMultiTrace, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NFAMultiTrace, /*tp_as_number*/
  &__pyx_tp_as_sequence_NFAMultiTrace, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NFAMultiTrace, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NFAMultiTrace, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5tests_7cyTrail_NFAMultiTrace, /*tp_traverse*/
  __pyx_tp_clear_5tests_7cyTrail_NFAMultiTrace, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5tests_7cyTrail_NFAMultiTrace, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5tests_7cyTrail_13NFAMultiTrace___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5tests_7cyTrail_NFAMultiTrace, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor __pyx_vtable_5tests_7cyTrail_NFACursor;

static PyObject *__pyx_tp_new_5tests_7cyTrail_NFACursor(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5tests_7cyTrail_NFACursor *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5tests_7cyTrail_NFACursor *)o);
  *(struct __pyx_vtabstruct_5tests_7cyTrail_NFACursor **)&p->__pyx_vtab = __pyx_vtabptr_5tests_7cyTrail_NFACursor;
  p->nfa = Py_None; Py_INCREF(Py_None);
  p->state = Py_None; Py_INCREF(Py_None);
  p->mtrace = ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)Py_None); Py_INCREF(Py_None);
  p->terminated = Py_None; Py_INCREF(Py_None);
  p->transitions = Py_None; Py_INCREF(Py_None);
  p->cache = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5tests_7cyTrail_NFACursor(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFACursor *p = (struct __pyx_obj_5tests_7cyTrail_NFACursor *)o;
  Py_XDECREF(p->nfa);
  Py_XDECREF(p->state);
  Py_XDECREF(((PyObject *)p->mtrace));
  Py_XDECREF(p->terminated);
  Py_XDECREF(p->transitions);
  Py_XDECREF(p->cache);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_5tests_7cyTrail_NFACursor(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5tests_7cyTrail_NFACursor *p = (struct __pyx_obj_5tests_7cyTrail_NFACursor *)o;
  if (p->nfa) {
    e = (*v)(p->nfa, a); if (e) return e;
  }
  if (p->state) {
    e = (*v)(p->state, a); if (e) return e;
  }
  if (p->mtrace) {
    e = (*v)(((PyObject*)p->mtrace), a); if (e) return e;
  }
  if (p->terminated) {
    e = (*v)(p->terminated, a); if (e) return e;
  }
  if (p->transitions) {
    e = (*v)(p->transitions, a); if (e) return e;
  }
  if (p->cache) {
    e = (*v)(p->cache, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5tests_7cyTrail_NFACursor(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_NFACursor *p = (struct __pyx_obj_5tests_7cyTrail_NFACursor *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->nfa);
  p->nfa = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->state);
  p->state = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mtrace);
  p->mtrace = ((struct __pyx_obj_5tests_7cyTrail_NFAMultiTrace *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->terminated);
  p->terminated = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->transitions);
  p->transitions = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cache);
  p->cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_5tests_7cyTrail_NFACursor[] = {
  {"derive_tree", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_derive_tree, METH_O, 0},
  {"node_sequence", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_node_sequence, METH_NOARGS, 0},
  {"set_token", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_set_token, METH_O, 0},
  {"terminate", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_terminate, METH_NOARGS, 0},
  {"set_nonterminal", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_set_nonterminal, METH_O, 0},
  {"move", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor_move, METH_VARARGS|METH_KEYWORDS, 0},
  {"_move", (PyCFunction)__pyx_pf_5tests_7cyTrail_9NFACursor__move, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NFACursor = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NFACursor = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_NFACursor = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_NFACursor = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_5tests_7cyTrail_NFACursor = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "tests.cyTrail.NFACursor", /*tp_name*/
  sizeof(struct __pyx_obj_5tests_7cyTrail_NFACursor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5tests_7cyTrail_NFACursor, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NFACursor, /*tp_as_number*/
  &__pyx_tp_as_sequence_NFACursor, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NFACursor, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NFACursor, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5tests_7cyTrail_NFACursor, /*tp_traverse*/
  __pyx_tp_clear_5tests_7cyTrail_NFACursor, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5tests_7cyTrail_NFACursor, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5tests_7cyTrail_9NFACursor___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5tests_7cyTrail_NFACursor, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor __pyx_vtable_5tests_7cyTrail_SimpleNFACursor;

static PyObject *__pyx_tp_new_5tests_7cyTrail_SimpleNFACursor(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *p;
  PyObject *o = __pyx_tp_new_5tests_7cyTrail_NFACursor(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor *)o);
  *(struct __pyx_vtabstruct_5tests_7cyTrail_SimpleNFACursor **)&p->__pyx_base.__pyx_vtab = __pyx_vtabptr_5tests_7cyTrail_SimpleNFACursor;
  return o;
}

static struct PyMethodDef __pyx_methods_5tests_7cyTrail_SimpleNFACursor[] = {
  {"move", (PyCFunction)__pyx_pf_5tests_7cyTrail_15SimpleNFACursor_move, METH_VARARGS|METH_KEYWORDS, 0},
  {"_move", (PyCFunction)__pyx_pf_5tests_7cyTrail_15SimpleNFACursor__move, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SimpleNFACursor = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SimpleNFACursor = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SimpleNFACursor = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SimpleNFACursor = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_5tests_7cyTrail_SimpleNFACursor = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "tests.cyTrail.SimpleNFACursor", /*tp_name*/
  sizeof(struct __pyx_obj_5tests_7cyTrail_SimpleNFACursor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5tests_7cyTrail_NFACursor, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_SimpleNFACursor, /*tp_as_number*/
  &__pyx_tp_as_sequence_SimpleNFACursor, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SimpleNFACursor, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SimpleNFACursor, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5tests_7cyTrail_NFACursor, /*tp_traverse*/
  __pyx_tp_clear_5tests_7cyTrail_NFACursor, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5tests_7cyTrail_SimpleNFACursor, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5tests_7cyTrail_15SimpleNFACursor___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5tests_7cyTrail_SimpleNFACursor, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};
static struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit __pyx_vtable_5tests_7cyTrail_LexerUnit;

static PyObject *__pyx_tp_new_5tests_7cyTrail_LexerUnit(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5tests_7cyTrail_LexerUnit *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5tests_7cyTrail_LexerUnit *)o);
  *(struct __pyx_vtabstruct_5tests_7cyTrail_LexerUnit **)&p->__pyx_vtab = __pyx_vtabptr_5tests_7cyTrail_LexerUnit;
  p->sym_name = Py_None; Py_INCREF(Py_None);
  p->tok_name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5tests_7cyTrail_LexerUnit(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_LexerUnit *p = (struct __pyx_obj_5tests_7cyTrail_LexerUnit *)o;
  Py_XDECREF(p->sym_name);
  Py_XDECREF(p->tok_name);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_5tests_7cyTrail_LexerUnit(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5tests_7cyTrail_LexerUnit *p = (struct __pyx_obj_5tests_7cyTrail_LexerUnit *)o;
  if (p->sym_name) {
    e = (*v)(p->sym_name, a); if (e) return e;
  }
  if (p->tok_name) {
    e = (*v)(p->tok_name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5tests_7cyTrail_LexerUnit(PyObject *o) {
  struct __pyx_obj_5tests_7cyTrail_LexerUnit *p = (struct __pyx_obj_5tests_7cyTrail_LexerUnit *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->sym_name);
  p->sym_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->tok_name);
  p->tok_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_5tests_7cyTrail_LexerUnit[] = {
  {"handle_unit", (PyCFunction)__pyx_pf_5tests_7cyTrail_9LexerUnit_handle_unit, METH_VARARGS|METH_KEYWORDS, 0},
  {"_handle_unit", (PyCFunction)__pyx_pf_5tests_7cyTrail_9LexerUnit__handle_unit, METH_VARARGS|METH_KEYWORDS, 0},
  {"_tostr_lst", (PyCFunction)__pyx_pf_5tests_7cyTrail_9LexerUnit__tostr_lst, METH_O, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LexerUnit = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LexerUnit = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_LexerUnit = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_LexerUnit = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_5tests_7cyTrail_LexerUnit = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "tests.cyTrail.LexerUnit", /*tp_name*/
  sizeof(struct __pyx_obj_5tests_7cyTrail_LexerUnit), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5tests_7cyTrail_LexerUnit, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_LexerUnit, /*tp_as_number*/
  &__pyx_tp_as_sequence_LexerUnit, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LexerUnit, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LexerUnit, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5tests_7cyTrail_LexerUnit, /*tp_traverse*/
  __pyx_tp_clear_5tests_7cyTrail_LexerUnit, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5tests_7cyTrail_LexerUnit, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5tests_7cyTrail_9LexerUnit___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5tests_7cyTrail_LexerUnit, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"is_token", (PyCFunction)__pyx_pf_5tests_7cyTrail_is_token, METH_O, 0},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC initcyTrail(void); /*proto*/
PyMODINIT_FUNC initcyTrail(void) {
  /*--- Libary function declarations ---*/
  __pyx_init_filenames();
  /*--- Module creation code ---*/
  __pyx_m = Py_InitModule4("cyTrail", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  /*--- Intern code ---*/
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  /*--- String init code ---*/
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;};
  /*--- Builtin init code ---*/
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_skip_dispatch = 0;
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_5tests_7cyTrail_NFATraceNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NFATraceNode", (PyObject *)&__pyx_type_5tests_7cyTrail_NFATraceNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_ptype_5tests_7cyTrail_NFATraceNode = &__pyx_type_5tests_7cyTrail_NFATraceNode;
  __pyx_vtabptr_5tests_7cyTrail_NFAMultiTrace = &__pyx_vtable_5tests_7cyTrail_NFAMultiTrace;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.set_token = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_set_token;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.terminate = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_terminate;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.flatten = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_flatten;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.update = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_update;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.commit = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_commit;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFAMultiTrace.derive_tree = (void(*)(void))__pyx_f_5tests_7cyTrail_13NFAMultiTrace_derive_tree;
  if (PyType_Ready(&__pyx_type_5tests_7cyTrail_NFAMultiTrace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_5tests_7cyTrail_NFAMultiTrace.tp_dict, __pyx_vtabptr_5tests_7cyTrail_NFAMultiTrace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NFAMultiTrace", (PyObject *)&__pyx_type_5tests_7cyTrail_NFAMultiTrace) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_ptype_5tests_7cyTrail_NFAMultiTrace = &__pyx_type_5tests_7cyTrail_NFAMultiTrace;
  __pyx_vtabptr_5tests_7cyTrail_NFACursor = &__pyx_vtable_5tests_7cyTrail_NFACursor;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFACursor._move = (void(*)(void))__pyx_f_5tests_7cyTrail_9NFACursor__move;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_NFACursor.get_next_state = (void(*)(void))__pyx_f_5tests_7cyTrail_9NFACursor_get_next_state;
  if (PyType_Ready(&__pyx_type_5tests_7cyTrail_NFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_5tests_7cyTrail_NFACursor.tp_dict, __pyx_vtabptr_5tests_7cyTrail_NFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NFACursor", (PyObject *)&__pyx_type_5tests_7cyTrail_NFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_ptype_5tests_7cyTrail_NFACursor = &__pyx_type_5tests_7cyTrail_NFACursor;
  __pyx_vtabptr_5tests_7cyTrail_SimpleNFACursor = &__pyx_vtable_5tests_7cyTrail_SimpleNFACursor;
  __pyx_vtable_5tests_7cyTrail_SimpleNFACursor.__pyx_base = *__pyx_vtabptr_5tests_7cyTrail_NFACursor;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_SimpleNFACursor.__pyx_base._move = (void(*)(void))__pyx_f_5tests_7cyTrail_15SimpleNFACursor__move;
  __pyx_type_5tests_7cyTrail_SimpleNFACursor.tp_base = __pyx_ptype_5tests_7cyTrail_NFACursor;
  if (PyType_Ready(&__pyx_type_5tests_7cyTrail_SimpleNFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_5tests_7cyTrail_SimpleNFACursor.tp_dict, __pyx_vtabptr_5tests_7cyTrail_SimpleNFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "SimpleNFACursor", (PyObject *)&__pyx_type_5tests_7cyTrail_SimpleNFACursor) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_ptype_5tests_7cyTrail_SimpleNFACursor = &__pyx_type_5tests_7cyTrail_SimpleNFACursor;
  __pyx_vtabptr_5tests_7cyTrail_LexerUnit = &__pyx_vtable_5tests_7cyTrail_LexerUnit;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_LexerUnit._handle_unit = (void(*)(void))__pyx_f_5tests_7cyTrail_9LexerUnit__handle_unit;
  *(void(**)(void))&__pyx_vtable_5tests_7cyTrail_LexerUnit._tostr_lst = (void(*)(void))__pyx_f_5tests_7cyTrail_9LexerUnit__tostr_lst;
  if (PyType_Ready(&__pyx_type_5tests_7cyTrail_LexerUnit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_5tests_7cyTrail_LexerUnit.tp_dict, __pyx_vtabptr_5tests_7cyTrail_LexerUnit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "LexerUnit", (PyObject *)&__pyx_type_5tests_7cyTrail_LexerUnit) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
  __pyx_ptype_5tests_7cyTrail_LexerUnit = &__pyx_type_5tests_7cyTrail_LexerUnit;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":1
 * SKIP = '.'             # <<<<<<<<<<<<<< 
 * 
 * cdef class NFATraceNode:
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_SKIP, __pyx_k_1p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}

  /* "C:\lang\Python25\Lib\site-packages\EasyExtend\langlets\cython\tests\cyTrail.pyx":312
 *             return [node, s, (line_begin, line_end), (col_begin, col_end)]
 * 
 *     cpdef _tostr_lst(self, node):             # <<<<<<<<<<<<<< 
 *         l_s = []
 *         for item in node:
 */
  return;
  __pyx_L1:;
  __Pyx_AddTraceback("tests.cyTrail");
}

static char *__pyx_filenames[] = {
  "cyTrail.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (obj->ob_type == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, obj->ob_type->tp_name);
    return 0;
}

static INLINE void __Pyx_RaiseArgtupleTooLong(
    Py_ssize_t num_expected,
    Py_ssize_t num_found)
{
    const char* error_message =
    #if PY_VERSION_HEX < 0x02050000
        "function takes at most %d positional arguments (%d given)";
    #else
        "function takes at most %zd positional arguments (%zd given)";
    #endif
    PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found);
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        obj->ob_type->tp_name, type->tp_name);
    return 0;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_type;
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_Get();
    PyErr_Fetch(type, value, tb);
    PyErr_NormalizeException(type, value, tb);
    if (PyErr_Occurred())
        goto bad;
    Py_INCREF(*type);
    Py_INCREF(*value);
    Py_INCREF(*tb);
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    /* Make sure tstate is in a consistent state when we XDECREF
    these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    Py_XDECREF(*type);
    Py_XDECREF(*value);
    Py_XDECREF(*tb);
    return -1;
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            PyErr_Format(PyExc_ValueError,
                #if PY_VERSION_HEX < 0x02050000
                    "need more than %d values to unpack", (int)index);
                #else
                    "need more than %zd values to unpack", index);
                #endif
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        PyErr_SetString(PyExc_ValueError, "too many values to unpack");
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    while (t->p) {
        *t->p = PyString_InternFromString(t->s);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        py_funcname = PyString_FromFormat( "%s (%s:%u)", funcname, __pyx_cfilenm, __pyx_clineno);
    }
    else {
        py_funcname = PyString_FromString(funcname);
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* Type Conversion Functions */

static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if (x == Py_False) return 0;
   else return PyObject_IsTrue(x);
}

static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) {
    if (PyInt_CheckExact(x)) {
        return PyInt_AS_LONG(x);
    }
    else if (PyLong_CheckExact(x)) {
        return PyLong_AsLongLong(x);
    }
    else {
        PY_LONG_LONG val;
        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
        val = __pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    if (PyInt_CheckExact(x)) {
        long val = PyInt_AS_LONG(x);
        if (unlikely(val < 0)) {
            PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type.");
            return (unsigned PY_LONG_LONG)-1;
        }
        return val;
    }
    else if (PyLong_CheckExact(x)) {
        return PyLong_AsUnsignedLongLong(x);
    }
    else {
        PY_LONG_LONG val;
        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
        val = __pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}


static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) {
    if (sizeof(unsigned char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        unsigned char val = (unsigned char)long_val;
        if (unlikely((val != long_val)  || (long_val < 0))) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char");
            return (unsigned char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) {
    if (sizeof(unsigned short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        unsigned short val = (unsigned short)long_val;
        if (unlikely((val != long_val)  || (long_val < 0))) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short");
            return (unsigned short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE char __pyx_PyInt_char(PyObject* x) {
    if (sizeof(char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        char val = (char)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to char");
            return (char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE short __pyx_PyInt_short(PyObject* x) {
    if (sizeof(short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        short val = (short)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to short");
            return (short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE int __pyx_PyInt_int(PyObject* x) {
    if (sizeof(int) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        int val = (int)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to int");
            return (int)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE long __pyx_PyInt_long(PyObject* x) {
    if (sizeof(long) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        long val = (long)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to long");
            return (long)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) {
    if (sizeof(signed char) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed char val = (signed char)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char");
            return (signed char)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) {
    if (sizeof(signed short) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed short val = (signed short)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short");
            return (signed short)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) {
    if (sizeof(signed int) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed int val = (signed int)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int");
            return (signed int)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) {
    if (sizeof(signed long) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        signed long val = (signed long)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long");
            return (signed long)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}

static INLINE long double __pyx_PyInt_long_double(PyObject* x) {
    if (sizeof(long double) < sizeof(long)) {
        long long_val = __pyx_PyInt_AsLong(x);
        long double val = (long double)long_val;
        if (unlikely((val != long_val) )) {
            PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double");
            return (long double)-1;
        }
        return val;
    }
    else {
        return __pyx_PyInt_AsLong(x);
    }
}
